diff --git a/lib/tasks/sql_review.rake b/lib/tasks/sql_review.rake new file mode 100644 index 000000000..761e6be60 --- /dev/null +++ b/lib/tasks/sql_review.rake @@ -0,0 +1,19 @@ +# 西部地区学校总数 +# select distinct(s.province), s.name from user_extensions ue, schools s where ue.school_id=s.id and s.province in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') +# +# 西部地区 +# select count(*) from courses where school_id in (select distinct(s.id) from user_extensions ue, schools s where ue.school_id=s.id and s.province in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') group by s.name) +# 用课门次=课程总数*45*12 +# +# 西部学习总人数 +# select count(*) from user_extensions ue where ue.school_id in (select id from schools s where s.province in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') group by s.name) +# 学习人次=西部实际学习总人数/平台实际用户总数 * 平台总学习人次 +# +# select distinct(s.province), s.name from user_extensions ue, schools s where ue.school_id=s.id and ue.location in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') +# +# select distinct(id) from courses where school_id in (select distinct(school_id) from user_extensions where location in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古')) +# +# select count(*) from course_members where course_id in (select distinct(id) from courses where school_id in (select distinct(school_id) from user_extensions where location in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古'))) +# +# # 西部地区学习人数 +# select count(*) from user_extensions where location in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') \ No newline at end of file