From b910c61f46c02dcd7669993ba7f00be443929f74 Mon Sep 17 00:00:00 2001 From: wubin Date: Fri, 5 Feb 2021 10:21:22 +0800 Subject: [PATCH] add --- BigDataSql/学校规模情况.txt | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 BigDataSql/学校规模情况.txt diff --git a/BigDataSql/学校规模情况.txt b/BigDataSql/学校规模情况.txt new file mode 100644 index 00000000..dd8a585a --- /dev/null +++ b/BigDataSql/学校规模情况.txt @@ -0,0 +1,46 @@ + + 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; + + + \ No newline at end of file