On Oct 12, 2011, at 5:28 PM, Simon Slavin wrote: > Was that not what you were expecting ? You are using count(2) not sum(2).
I guess the posted test case had a typo. Nonetheless, contrast: sqlite> select a, sum(case when b = 't' then 1 end), sum(case when b = 'T' then 1 end) from t group by a; 1|2|2 2|1|1 sqlite> select a, sum(case when lower( b ) = b and b = 't' then 1 end), sum(case when upper( b) = b and b = 'T' then 1 end) from t group by a; 1|2|1 2|1|2 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users