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
Setting FALSE as second parameter, 'select' allows to write a custom sentence.
$this->db->select('description, SUM(amount) AS amount', FALSE);
$this->db->where('date_payment >=', $min_date);
$this->db->where('date_payment <=', $max_date);
$this->db->group_by("description");
$qwer = $this->db->get('PAYMENT');
Documentation for CI2
Documentation for CI3