用于并列查询
有如下person表,查询出类型为1和2的各占多少
id type name
1 1 li
2 1 jackson
3 1 mark
4 1 didong
5 1 hanmeimei
6 2 lilei
7 2 polly
8 2 park
select count(case when t.type='1' then t.name else '' end) count1,
count(case when t.type='2' then t.name else '' end) count2
from person t
result:
count1 5
count2: 3