You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dsMin/ReportSQL/029初中学生数 .txt

30 lines
2.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

SELECT sbr.organizationNo ,2 as schoolTypeGroupNo,'二、义务教育' as schoolTypeGroup,2 as schoolTypeGroupNo2,'(二)初中阶段' as schoolTypeGroup2 ,sbr.businessTypeNo,sbr.businessType
,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation
, sbr.isCount , sum(f) as zhaoshengNo,sum(i+j+k+l) as zaixiaoNo,sum(e) as biyeNo,sum(h) as nvNo,sum(m) as yuji_biyeNo,sum(i) as grade1,sum(j) as grade2,sum(k) as grade3
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J313 as j on j.instanceid =it.instanceid and j.did in (1,36,37,38,39,40,41,42,43,44)
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('311','312','319','321','341','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
order by sbr.businessTypeNo;
--did
--少数民族3
--女2
--随迁子女8
-- 其中外省迁入9
-- 本省外县迁入10
--进城务工人员随迁子女11
-- 其中外省迁入12
-- 本省外县迁入13
--农村留守儿童14
--送教上门18 - 24
SELECT sbr.organizationNo ,2 as schoolTypeGroupNo,'二、义务教育' as schoolTypeGroup,2 as schoolTypeGroupNo2,'(二)初中阶段' as schoolTypeGroup2 ,sbr.businessTypeNo,sbr.businessType
,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation
, sbr.isCount , sum(f) as zhaoshengNo,sum(i+j+k+l) as zaixiaoNo,sum(e) as biyeNo,sum(h) as nvNo,sum(m) as yuji_biyeNo,sum(i) as grade1,sum(j) as grade2,sum(k) as grade3,did
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J313 as j on j.instanceid =it.instanceid and j.did between 8 and 15
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('311','312','319','321','341','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,did
order by sbr.businessTypeNo;