题解 | #每个6/7级用户活跃情况#

每个6/7级用户活跃情况

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

提供Mysql下一种相当粗暴的解法……看了一下好像还没有人发过

select user_info.uid, ifnull(count(distinct month),0) a1,
       ifnull(count(distinct day),0) a2,
       ifnull(count(distinct examday),0),
       ifnull(count(distinct questionday),0)
from (
    select uid, date_format(a.start_time,'%Y%m') month,
           if(year(start_time)=2021,date_format(a.start_time,'%Y%m%d'),null) day,
           if(exam_id like '9%' and year(start_time)=2021,date_format(a.start_time,'%Y%m%d'),null) examday,
           if(exam_id like '8%' and year(start_time)=2021,date_format(a.start_time,'%Y%m%d'),null) questionday
    from (select uid,exam_id,start_time from exam_record union
          select uid,question_id,submit_time from practice_record) a) b
right join user_info on user_info.uid = b.uid
where level between 6 and 7
group by uid
order by a1 desc, a2 desc
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 17:10
点赞 评论 收藏
分享
这是什么操作什么意思,这公司我服了...
斯派克spark:意思是有比你更便宜的牛马了
点赞 评论 收藏
分享
下个早班:秒挂就是不缺人
点赞 评论 收藏
分享
来个大佬救一下,为上投了都是石沉大海了,没实习经历的话怕秋招直接进不了面。什么实习这么难找,基本
心态爆炸了:现在正式的岗位都少,实习基本不咋招的,除了大厂,中小企业其实没那么多岗位需求,就算是有,大多都是招一两个廉价劳动力,同时,他们也会希望你一来就能干活的,没时间培训你,就让你了解公司的项目,你了解完就可以开始干活。再者是,很多低质量的实习其实用处没有那么大的。我去年也是找实习找到破防,最后去了一家深圳的小公司实习,工作对我来说很简单,甚至不如我在学校做的项目,秋招的时候,这段实习经历也并没有帮上什么忙,投递简历,依旧非常低的回复率。低回复率是常态,尤其是找实习,找不到,那就把重心放在优化自己的简历和项目,多看八股文,锻炼自己的面试能力,多看别人的面经,自己模拟面试,等秋招的时候,只要有那么寥寥几次,好好抓住那几次机会。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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