jeudi 23 juillet 2015

Is there an easy way to count different matches with one SQLite query?

I have a SQLite table, and I could do three different queries, like this pseudoSQL...

SELECT COUNT(*) FROM myTable WHERE day=today AND colA = "xxx";
SELECT COUNT(*) FROM myTable WHERE day=today AND colB = "yyy";
SELECT COUNT(*) FROM myTable WHERE day=today AND colC = "zzz";

I essentially want to know if there are any matches (and if so, which column) for today. Is there a better way to do this?

Aucun commentaire:

Enregistrer un commentaire