题解 | #今天的刷题量(一)#

今天的刷题量(一)

http://www.nowcoder.com/practice/e18f56796ae94c3d885e61c8d57a950e


明确问题:查找出当天每个题单的刷题量
首先计算出当天的每个题单的刷题数量,利用current_date函数把日期定在今天
  • select subject_id,count(subject_id)cnt
  •  from  submission
  • where create_time=current_date
  • group by subject_id
 然后与subject表进行连接,最后提交数量降序,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
全部评论

相关推荐

03-27 17:33
门头沟学院 Java
代码飞升:同学院本,你要注意hr当天有没有回复过,早上投,还要打招呼要推销自己,不要一个劲投
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务