Is there an easy way to count different matches with one SQLite query? -
i have sqlite table, , 3 different queries, pseudosql...
select count(*) mytable day=today , cola = "xxx"; select count(*) mytable day=today , colb = "yyy"; select count(*) mytable day=today , colc = "zzz";
i want know if there matches (and if so, column) today. there better way this?
select sum(o.a) a, sum(o.b) b, sum(o.c) c ( select case when t.cola = 'xxx' 1 else 0 end a, case when t.colb = 'yyy' 1 else 0 end b, case when t.colc = 'zzz' 1 else 0 end c mytable t t.day = today ) o ;
Comments
Post a Comment