• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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();


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.