select 统计数据

select
e.emp_name workID,
sum(case when i.status = 'New' THEN 1 ELSE 0 END) bugNum,
sum(case when i.status = 'New' and i.serious_level like '%blocker%' THEN 1 ELSE 0 END) blocker,
sum(case when i.status = 'New' and i.serious_level like '%major%' THEN 1 ELSE 0 END) major,
sum(case when i.status = 'New' and i.serious_level like '%normal%' THEN 1 ELSE 0 END) normal

from issue i
join employee e on e.work_no=i.assigned_to_workno
join project p on p.aone_project_id = i.aone_project_id

where p.id = 339
group by e.emp_name;

你可能感兴趣的:(select 统计数据)