sql 多个字段分组查询语句

sql 多个字段分组查询语句_第1张图片select t.county,t.status_project,count(1) from XM_SEWAGEWORK_INFO t group by t.county,t.status_project 


select 
 COUNT (CASE WHEN status_project = 'BGS' THEN 1   ELSE NULL   END) cstatus_1, sql 多个字段分组查询语句_第2张图片
COUNT (CASE WHEN status_project = 'ZHL' THEN 1
                       ELSE NULL
                       END) cstatus_2,county
 from XM_SEWAGEWORK_INFO t group by t.county

你可能感兴趣的:(java)