多行 并 一行查询


select
   count( case  when status='1' then number1 end) as '检查不及格',
      count(case when status='2' then number1 end)  as '终止作废',
        sum( case when status='3' then number2 end)  as '遗失作废'
from   table1

原文地址:https://www.cnblogs.com/kevin2013/p/1941495.html