|
|
|
@ -144,10 +144,53 @@ ORDER BY
|
|
|
|
|
#end
|
|
|
|
|
-- 区域建设排名前5
|
|
|
|
|
#sql("areaTop5")
|
|
|
|
|
SELECT gather_regionc,COUNT(*) as cnt FROM t_crawler_lesson_school WHERE match_type=2 GROUP BY gather_regionc ORDER BY cnt DESC LIMIT 5
|
|
|
|
|
WITH base_stats AS (
|
|
|
|
|
SELECT
|
|
|
|
|
gather_regionc,
|
|
|
|
|
COUNT(*) as total_cnt
|
|
|
|
|
FROM t_crawler_lesson_school
|
|
|
|
|
WHERE match_type = 2
|
|
|
|
|
GROUP BY gather_regionc
|
|
|
|
|
),
|
|
|
|
|
signin_stats AS (
|
|
|
|
|
SELECT
|
|
|
|
|
gather_regionc,
|
|
|
|
|
COUNT(DISTINCT organization_name) as signin_cnt
|
|
|
|
|
FROM 教基1001
|
|
|
|
|
WHERE school_running_type_no IN ('211','341','312','345','342','311')
|
|
|
|
|
GROUP BY gather_regionc
|
|
|
|
|
),
|
|
|
|
|
construct_stats AS (
|
|
|
|
|
SELECT
|
|
|
|
|
gather_regionc,
|
|
|
|
|
COUNT(DISTINCT organization_name) as construct_cnt
|
|
|
|
|
FROM t_crawler_lesson_school
|
|
|
|
|
GROUP BY gather_regionc
|
|
|
|
|
)
|
|
|
|
|
SELECT
|
|
|
|
|
b.gather_regionc,
|
|
|
|
|
b.total_cnt,
|
|
|
|
|
COALESCE(s.signin_cnt, 0) as signin_cnt,
|
|
|
|
|
COALESCE(c.construct_cnt, 0) as construct_cnt
|
|
|
|
|
FROM base_stats b
|
|
|
|
|
LEFT JOIN signin_stats s ON b.gather_regionc = s.gather_regionc
|
|
|
|
|
LEFT JOIN construct_stats c ON b.gather_regionc = c.gather_regionc
|
|
|
|
|
ORDER BY b.total_cnt DESC;
|
|
|
|
|
#end
|
|
|
|
|
-- 更新区域建设排名前5
|
|
|
|
|
#sql("updateAreaTop5")
|
|
|
|
|
update `excel_数据_a03b1bfada` set `区域`=?,`课程建设数量`=?,`注册学校`=?,`参与课程建设学校`=? where `排序`=?
|
|
|
|
|
update `excel_数据_a03b1bfada` set `区域`=?,`课程建设总量`=?,`注册学校`=?,`参与课程建设学校`=? where `排序`=?
|
|
|
|
|
#end
|
|
|
|
|
|
|
|
|
|
-- 学段应用分布
|
|
|
|
|
#sql("stageYingYingFenBu")
|
|
|
|
|
-- 小学
|
|
|
|
|
SELECT '小学' as stage_name, T2.subject_name,COUNT(DISTINCT lesson_id) as cnt,ROUND(COUNT(DISTINCT lesson_id) * 100.0 / SUM(COUNT(DISTINCT lesson_id)) OVER(),2) as percent FROM t_crawler_lesson T1 INNER JOIN t_crawler_subject T2 ON T1.subject_id=T2.subject_id WHERE T1.stage_id='2' AND T1.node_type=1 AND T1.subject_id IN ('213','241','214','264','215','225','228','224') GROUP BY T2.subject_name
|
|
|
|
|
union all
|
|
|
|
|
-- 初中
|
|
|
|
|
SELECT '初中', T2.subject_name,COUNT(DISTINCT lesson_id) as cnt,ROUND(COUNT(DISTINCT lesson_id) * 100.0 / SUM(COUNT(DISTINCT lesson_id)) OVER(),2) as percent FROM t_crawler_lesson T1 INNER JOIN t_crawler_subject T2 ON T1.subject_id=T2.subject_id WHERE T1.stage_id='3' AND node_type=1 AND T1.subject_id IN ('313','314','341','316','317','318','321','320','364','325','322','324') GROUP BY T2.subject_name
|
|
|
|
|
union all
|
|
|
|
|
-- 高中
|
|
|
|
|
SELECT '高中', T2.subject_name,COUNT(DISTINCT lesson_id) as cnt,ROUND(COUNT(DISTINCT lesson_id) * 100.0 / SUM(COUNT(DISTINCT lesson_id)) OVER(),2) as percent FROM t_crawler_lesson T1 INNER JOIN t_crawler_subject T2 ON T1.subject_id=T2.subject_id WHERE T1.stage_id='4' AND node_type=1 AND T1.subject_id IN ('413','414','416','441','417','418','448','421','420','425','422','424') GROUP BY T2.subject_name
|
|
|
|
|
#end
|
|
|
|
|
#end
|