下列二条SQL命令,能否合成一条?
select sum(A字段) as 合格品 from table where 字段B is null
select sum(A字段) as 不合格品 from table where 字段B is not null
请指导,先谢过各位了
------解决思路----------------------
SELECT SUM(CASE WHEN 字段B is null THEN A字段 END)as 合格品
,SUM(CASE WHEN 字段B is not null THEN A字段 END)as 不合格品
FROM table