master
黄海 4 years ago
parent 43b43ce2e7
commit fe31454f9e

@ -1 +1,6 @@
select * from mv_dp_zrjsssbl
select * from mv_dp_zrjsssbl
order by
(case when stage='小学' then 1
when stage='初中' then 2
when stage='高中' then 3
end)

@ -1,22 +1,9 @@
select businesstype,count as total from mv_dp_gjdxxsl order by
(case when businesstype='小学' then 1
when businesstype='初级中学' then 2
when businesstype='九年一贯制学校' then 3
when businesstype='高级中学' then 4
when businesstype='完全中学' then 5
when businesstype='十二年一贯制学校' then 6
end)
SELECT businessType,count(1) as count
from schoolBusinessRelation sbr where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('211') and sbr.isLastYearCancel =0 and sbr.recordyear =2019
group by sbr.businessType
union all
SELECT businessType ,count(*) as c
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') and sbr.isLastYearCancel =0 and sbr.recordyear =2019 and it.recordyear =2019 and j.recordyear =2019
group by sbr.businessType
union all
SELECT sbr.businessType,count(1) as c
from schoolBusinessRelation sbr where sbr.gatherRegionB ='长春市' and sbr.businessTypeNo in('341','342','345') and sbr.isLastYearCancel =0
GROUP BY sbr.businessType
-- select * from codeschooltype where schooltypeno in ('211','218','312','345','321')

@ -1,46 +1,5 @@
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;
select stage,studentno as total from mv_dp_xxgmqk order by
(case when stage='小学' then 1
when stage='初中' then 2
when stage='高中' then 3
end)

Loading…
Cancel
Save