分组查询并统计相应状态数量
SELECT t1,count(1) as "total",
sum(case when (status='1' and status='2') then '1' else '0' end) as "status_1",
sum(case when status='0' then '1' else '0' end) as "status_2"
FROM account WHERE 1=1 GROUP BY p1
SELECT t1,count(1) as "total",
sum(case when (status='1' and status='2') then '1' else '0' end) as "status_1",
sum(case when status='0' then '1' else '0' end) as "status_2"
FROM account WHERE 1=1 GROUP BY p1