@@ -585,4 +585,15 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
...
@@ -585,4 +585,15 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
id sqty cqty
id sqty cqty
1 5 2
1 5 2
2 9 2
2 9 2
select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
count(*) category
2 NULL
1 one
1 two
select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;