# 西部地区学校总数 # 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) # 用课门次=课程总数*30*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 s.name, s.province, count(ue.id) from user_extensions ue left join schools s on ue.school_id = s.id and s.province in ('四川','重庆','贵州','云南','西藏','陕西','甘肃','青海','宁夏','新疆广西','内蒙古') group by s.name # #