If you are looking to add aggregate functions(MAX, MIN, AVG, SUM) in Codelgniter. Please use the below code for the same:
// Use Max function to get maximum salary in employee table
$this->db->select_max('salary');
$queryExe = $this->db->get('employee');
// Use min function to get minimum salary in employee table
$this->db->select_min('salary');
$queryExe = $this->db->get('employee');
// Use avg function to get average salary in employee table
$this->db->select_avg('salary');
$queryExe = $this->db->get('employee');
// Use sum function to get total salary of employee table
$this->db->select_sum('salary');
$queryExe = $this->db->get('employee');
0 Comment(s)