--did: --22、正高级 --23、副高级 --24、中级 --25、助理级 --26、员级 --27、未定职级 SELECT sbr.organizationNo ,1 as schoolTypeGroupNo,'一、高中阶段' as schoolTypeGroup,1 as schoolTypeGroupNo2,'(一)普通高中' as schoolTypeGroup2 ,sbr.businessTypeNo,sbr.businessType ,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation ,sbr.gatherregionc ,va.region_no , sbr.isCount , sum (F + G + H + I +j+k+l+ M + N ) as teacherNO,j.did from schoolBusinessRelation sbr inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno inner join J422 as j on j.instanceid =it.instanceid and did in (22,23,24,25,26,27) inner join v_areainfo va on va.region_name =sbr.gatherregionc where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in ('341','342','345') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019 group by sbr.organizationNo,sbr.businessTypeNo,sbr.businessType ,sbr.isCount,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation,sbr.gatherregionc ,va.region_no,j.did order by sbr.businessTypeNo; --did: --13、研究生毕业 --14、本科毕业 --15、专科毕业 --16、高中阶段毕业 --17、高中阶段以下毕业 SELECT sbr.organizationNo ,1 as schoolTypeGroupNo,'一、高中阶段' as schoolTypeGroup,1 as schoolTypeGroupNo2,'(一)普通高中' as schoolTypeGroup2 ,sbr.businessTypeNo,sbr.businessType ,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation ,sbr.gatherregionc ,va.region_no , sbr.isCount , sum (F + G + H + I + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + AC + AD) as teacherNO2 ,did from schoolBusinessRelation sbr inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno inner join J424 as j on j.instanceid =it.instanceid and did in (13,14,15,16,17) inner join v_areainfo va on va.region_name =sbr.gatherregionc where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in ('311','312','321','341','342','345') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019 group by sbr.organizationNo,sbr.businessTypeNo,sbr.businessType ,sbr.isCount,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation,sbr.gatherregionc ,va.region_no ,did order by sbr.businessTypeNo;