並列統計CASE WHEN

 

select sum(case when depart = 'Physical' then 1 else 0 end) PhyTotal,
 sum(case when depart = 'Chemistry' then 1 else 0 end) CheTotal,
sum(case when depart = 'Math' then 1 else 0 end ) MathTotal
from student 
相關文章
相關標籤/搜索