$totals = $this->db ->select('SUM(qty * price) as total', FALSE) //2nd parameter FALSE tells CI to not protect the identifiers, which it has problems with more complex stuff like this ->get('trans_report') ->result_array();