select project_id,problem_class,
count(case when status=1 then 1 else 0 end) as 新问题,
count(case when status=2 then 1 else 0 end) as 解决中,
count(case when status=9 then 1 else 0 end) as 已解决
from Pro_AS_Problem
count(case when status=1 then 1 else 0 end) as 新问题,
count(case when status=2 then 1 else 0 end) as 解决中,
count(case when status=9 then 1 else 0 end) as 已解决
from Pro_AS_Problem
where 1=1 group by project_id ,problem_class order by project_id
select project_id,problem_class,
(case status
when 1 then '新问题'
when 2 then '解决中'
when 9 then '已解决'
else '空的'
end
)status,
1 as status_count from Pro_AS_Problem order by project_id