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

今天的刷题量(一)

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

SELECT b.name, count(*) as cnt from submission s inner join subject b on s.subject_id = b.id
where create_time = curdate()
group by b.name, b.id
order by cnt desc, s.subject_id asc

两个注意的点,

  1. 是order by是要先按cnt,再按照subject_id排序,此时就不能只对name进行分组,而应该加上subject_id

  1. 获取当天的日期使用函数curdate()
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务