sql聚合函数使用-笔记 SELECT SUM ( case when procurement_type = '公益推送' then 1 else 0 end ) gywxTotal, SUM ( CASE WHEN (status = 1 and procurement_type = '公益推送') THEN 1 ELSE 0 END ) gywxYsc, SUM ( CASE WHEN (status != 1 and procurement_type = '公益推送') THEN 1 ELSE 0 END ) gywxWsc, SUM ( case when procurement_type = '商业采购' then 1 else 0 end ) sywxTotal, SUM ( CASE WHEN (status = 1 and procurement_type = '商业采购') THEN 1 ELSE 0 END ) sywxWsc, SUM ( CASE WHEN (status != 1 and procurement_type = '商业采购') THEN 1 ELSE 0 END ) sywxYsc FROM st_2k_image_org_s WHERE image_type = 1 and year = '2023'