Doing sum's if certain conditions are true
- by Gugu
I am trying to build a query that does a sum if a certain parameter is
set. For example:
SELECT SUM(IF(<condition>,field,field)) AS total_value
...which is working correctly.
But i have more than one condition in IF(), like:
SELECT SUM(IF(<condition> <condition>,field,field)) AS total_value
..which is not working, could you have any idea what should be the right query for this.