If condition on SQL
I have the following sql statement
So, I would like mysql to check each row as summing and if the crn field is "EURO" then the respective field value for line_net should be multiplied by a given constant value
"SELECT fat_id, crn, sum(adet) as ad, sum(line_net) as ln, sum(line_vat) as lv, sum(line_grand) as lg FROM inv_lines where fat_id='$row->id' group by fat_id"
Is it possible
$sql = ". . . SUM(IF(`cm`='EURO', `line_net` * $multiplier, `line_net`)) . . .";
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)