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.
46 lines
3.0 KiB
46 lines
3.0 KiB
|
|
select a as stage,sum(c1) as studentno,sum(c2) as schoolno from (
|
|
SELECT '小学' as a,sum(j+k+l+m+n+o) as c1,0 as c2
|
|
from schoolBusinessRelation sbr
|
|
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
|
|
inner join J312 as j on j.instanceid =it.instanceid and j.did in (1,37,38,39,40,41,42,43,44,45,46,47)
|
|
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('211','218','219','312','345') and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
|
|
group by sbr.cityCountryGroup
|
|
union all
|
|
SELECT '初中' as a,sum(i+j+k+l) as c1,0 as c2
|
|
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.cityCountryGroup
|
|
union all
|
|
SELECT '高中' as a,sum(i+j+k) as c1,0 as c2
|
|
from schoolBusinessRelation sbr
|
|
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
|
|
inner join J314 as j on j.instanceid =it.instanceid and did in (1,11,12,13,14,15,16,17,18,19)
|
|
inner join v_areainfo va on va.region_name =sbr.gatherregionc
|
|
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('341','342','345','349') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
|
|
group by sbr.cityCountryGroup
|
|
union all
|
|
SELECT '小学' as a,0 as c1,count(*) as c2
|
|
from schoolBusinessRelation sbr
|
|
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
|
|
inner join J412 as j on j.instanceid =it.instanceid and j.did =1
|
|
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('211') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
|
|
union all
|
|
SELECT '初中' as a,0 as c1,count(*) as c2
|
|
from schoolBusinessRelation sbr
|
|
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
|
|
inner join J412 as j on j.instanceid =it.instanceid and j.did =1
|
|
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('311','312','341','345') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
|
|
union all
|
|
SELECT '高中' as a,0 as c1,count(*) as c2
|
|
from schoolBusinessRelation sbr
|
|
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
|
|
inner join J412 as j on j.instanceid =it.instanceid and j.did =1
|
|
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
|
|
) t
|
|
group by a;
|
|
|
|
|
|
|