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