I’m using this query:
SELECT SUM(voc=1) AS s, SUM(voc=2) AS d, SUM(voc=3) AS p FROM `pl`;
But now I need to modify this query, so it’ll SUM when voc is equal to the multiple numbers:
SELECT SUM ( voc = 1 OR voc = 7 OR voc = 3 ) as `s` FROM `pl`;
Unfortunately , the above is not working properly, I’ve read that this can be done using CASE, but my knowledge about that is too small…
UPD As stated by @Raul in comment –
WHEREshould be much more effective, like this:UPD2 Changed Sum’s to Count’s – thanks to @newtower