I need to build this query in Codeigniter but I don\'t know how to get the result of the SUM:
SELECT description, SUM(amount) FROM PAYMENT WHERE
try something like this:
$query = $this->db->select_sum('amount', 'Amount'); $query = $this->db->where(...) $query = $this->db->get('payment'); $result = $query->result(); return $result[0]->Amount;