Re: [SQL ] table中分群做count

楼主: joedenkidd (优质的蓝色射手)   2017-05-04 20:54:33
select date,count(case when value='a' then 1 else null end) as count_a,count(case when value='b' then 1 else null end) as count_b from table group by date
这样应该可以达到你要的结果
作者: Czero (悠闲)   2017-05-04 21:23:00
Thanks~!

Links booklink

Contact Us: admin [ a t ] ucptt.com