po完才发现昨天joedenkidd大大已经有PO更好的解决方法
献丑了
练习一下
select tmpA.date , tmpeA.count_a , tmpeB.count_b from
(select date,count(value) as count_a from table where value='a' group by date)
as tmpA
inner join
(select date count(value) as count_b from table where value='b' group by date)
as tmpB
on tmpA.date =tmpB.date
结果如下
date count_a count_b