题解 | #未完成试卷数大于1的有效用户#

月均完成试卷数不小于3的用户爱作答的类别

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

select ei.tag
,count(*) as tag_cnt
from exam_record er left join examination_info ei
on er.exam_id=ei.exam_id
where er.uid in
   (select uid 
   from
   (
      select
      uid
      ,avg(a.月完成数) as 月均完成数
      from
         (select
         uid
         ,month(start_time)
         ,count(*) as 月完成数
         from exam_record
         where score is not null
         group by 1,2
         )a
      group by 1
   )b where b.月均完成数>=3)
group by 1
order by 2 desc
全部评论

相关推荐

ldf李鑫:不说公司名祝你以后天天遇到这样的公司
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务