Welcome Guest, Not a member yet? Register   Sign In
sum Multiplication quey
#1

[eluser]Unknown[/eluser]
can same body help me?


how do i implement this query mysql to codeigniter model

select sum(qty*price) as total from trans_report

#2

[eluser]CroNiX[/eluser]
Try
Code:
$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();




Theme © iAndrew 2016 - Forum software by © MyBB