SQLServer多表相同字段的其他字段数据汇总查询

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41913666/article/details/79750345


SELECT m.Application_department,COUNT(m.Application_department) AS Daily_matters,
                             (select COUNT(Department)
                              from S_workExaminationForm
                              where Department=m.Application_department
                              )AS Major_matters
                              FROM S_MilepostItem as m
                              GROUP BY m.Application_department 
                              HAVING      (COUNT(m.Application_department) > 0)

效果图:

没有更多推荐了,返回首页