明确问题:查找出当天每个题单的刷题量
首先计算出当天的每个题单的刷题数量,利用current_date函数把日期定在今天
- select subject_id,count(subject_id)cnt
- from submission
- where create_time=current_date
- group by subject_id
- select b.name,cnt
- from
- (select subject_id,count(subject_id)cnt
- from submission
- where create_time=current_date
- group by subject_id
- ) as a
- join subject as b
- on a.subject_id=b.id
- order by cnt desc ,a.subject_id

京公网安备 11010502036488号