master
wubin 5 years ago
parent b79c1658fa
commit f1674414b8

@ -0,0 +1,7 @@
SELECT sbr.organizationNo ,1 as schoolTypeGroupNo,'一、高中阶段' as schoolTypeGroup,2 as schoolTypeGroupNo2,'(二)中等职业学校' as schoolTypeGroup2 ,sbr.businessTypeNo
, case when sbr.businessTypeNo in ('369') then '其他机构(班)' when sbr.businessTypeNo in ('368') then '附设中职班' else sbr.businessType end as businessType
,sbr.ownertypeno ,sbr.ownerTypeGroup ,sbr.citycountrytypeno ,sbr.cityCountryGroup,sbr.structureType,sbr.populationGroup,sbr .isnation , isCount ,sbr.gatherregionc ,va.region_no
from schoolBusinessRelation sbr
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('362','364','365','361','363','368','369') and sbr.isLastYearCancel =0
order by sbr.businessTypeNo;

@ -0,0 +1,11 @@
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.gatherregionc ,va.region_no
,case when sbr.businessTypeNo='341' then 0 when sbr.businessTypeNo='345' then 0 else 1 end as isCount , sum(g+h+i+j) as classNo
, sum(g) as g, sum(h) as h, sum(i) as i, sum(j) as j
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J213 as j on j.instanceid =it.instanceid
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in ('311','312','321') 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
order by sbr.businessTypeNo,va.region_no ;

@ -0,0 +1,11 @@
SELECT sbr.organizationNo ,2 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
,case when sbr.businessTypeNo='211' then 1 else 0 end as isCount , sum(f+g+h+i+j+k) as classNo
,sum(f),sum(g),sum(h),sum(i),sum(j),sum(k),sum(h)
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J212 as j on j.instanceid =it.instanceid
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('211','218','219','312','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
order by sbr.businessTypeNo,va.region_no ;

@ -0,0 +1,12 @@
--did
--1 总数
--2 女
SELECT sbr.organizationNo ,4 as schoolTypeGroupNo,'四、工读学校' as schoolTypeGroup,0 as schoolTypeGroupNo2,'' as schoolTypeGroup2 ,sbr.businessTypeNo,sbr.businessType ,sbr.gatherregionc ,va.region_no
, sbr.isCount,sum(d),sum(e),sum(f),sum(g),sum(h),sum(i),did
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J911 as j on j.instanceid =it.instanceid and j.did in (1,2)
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('371') 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,did ,sbr.gatherregionc ,va.region_no
order by sbr.businessTypeNo;

@ -0,0 +1,25 @@
--学校数 + 学生数
SELECT sbr.organizationNo ,3 as schoolTypeGroupNo,'三、特殊教育' as schoolTypeGroup,0 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) as zhaoshengNo,sum(I + J + K + L + M + N + O + P + Q + R + S + T + U + V) as zaixiaoNo,sum(e) as biyeNo,sum(h) as nvNo,
sum(i),sum(j),sum(k),sum(l),sum(m),sum(n),sum(o),sum(p),sum(q),sum(r),sum(s),sum(t),sum(u),sum(v)
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J315 as j on j.instanceid =it.instanceid and did between 16 and 22
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' 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
order by sbr.businessTypeNo;
--班级数
SELECT sbr.organizationNo ,3 as schoolTypeGroupNo,'三、特殊教育' as schoolTypeGroup,0 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(e+f+g+h+I + J + K + L + M + N + O + P + Q +R) as classNo
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J214 as j on j.instanceid =it.instanceid and did in(2,3,4,5,6,7,8)
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' 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
order by sbr.businessTypeNo;

@ -0,0 +1,23 @@
--班级
SELECT sbr.organizationNo ,5 as schoolTypeGroupNo,'五、学前教育' as schoolTypeGroup,0 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
,case when sbr.businessTypeNo='111' then 1 else 0 end as isCount , sum(e + f + g + h) as classNo
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J211 as j on j.instanceid =it.instanceid
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('111','119') 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
order by sbr.businessTypeNo,va.region_no ;
--学生
SELECT sbr.organizationNo ,5 as schoolTypeGroupNo,'五、学前教育' as schoolTypeGroup,0 as schoolTypeGroupNo2,'' as schoolTypeGroup2,sbr.businessTypeNo,sbr.businessType
,sbr .isnation ,sbr.gatherregionc ,va.region_no
,case when sbr.businessTypeNo='111' then 1 else 0 end as isCount,sum( e+f+g+h) as zhaoshengNo,sum(k+l+m+n) as zaixiaoNo,sum(o) as biyeNo
from schoolBusinessRelation sbr
inner join instanceTable it on sbr.organizationNo =it.organizationNo and sbr.businesstypeno =it.businesstypeno
inner join J311 as j on j.instanceid =it.instanceid and j.did in (5,6,7,8,9)
inner join v_areainfo va on va.region_name =sbr.gatherregionc
where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('111','119') and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
group by sbr.organizationNo,sbr.businessTypeNo,sbr.businessType ,sbr.isCount,sbr .isnation ,sbr.gatherregionc ,va.region_no
order by sbr.businessTypeNo;
Loading…
Cancel
Save