下面的sql怎么写?求助(酷狗的笔试题)

第一题我是这样写的,不知道对不对(不对的话还请大佬帮修改下),select songid from t_play as t1(select count(*) from t_play as t2 where t2.dt=t1.dt and t2.area=t1.area and t2.play_cnt<t1.play_cnt)<=2, 另外还有简单的写法吗?这个用group by能实现吗?
第二题不会写,求教!
全部评论
不会做,然后笔试没过
点赞 回复 分享
发布于 2018-05-19 18:28
1.select d.dt,a.area,d.songid from t_user a,(select * from t_user b,t_play c where b.area=a.area and  c.dt=d.dt and b.userid=c.userid order by c.play_cnt desc limit 0,3) e ,t_play  d group by d.dt,a.area having e.area=a.area and d.dt=e.dt and a.userid=d.userid ; 2 select  (select count(*) from  t_user, t_play where t_user.userid=t_play.userid and t_play.dt=20180502 and  t_user.userid  in (select * from t_user a, t_play b where a.userid=b.userid and b=20180501))/(select count(*)from t_user, t_play where t_user.userid=t_play.userid and t_play.dt=20180501)
点赞 回复 分享
发布于 2018-05-19 20:08

相关推荐

神哥不得了:神哥来啦~1.建议不要包装,很容易问穿2.没日常也能找到暑期3.简历模板换一下,字体和版式看着好难受,而且最好压缩到一页,技术的倒数第2和3重复啦,项目建议换两个高质量的上去,如果时间够的话,八股就把高频top50的题目多巩固几遍,吃透,注意不要找假高频,这样绝对能找到暑期
点赞 评论 收藏
分享
03-02 10:51
邵阳学院 Java
红鲤鱼与绿鲤鱼i:看了你的头像不像找工作,像在找妹子
点赞 评论 收藏
分享
评论
点赞
25
分享

创作者周榜

更多
牛客网
牛客企业服务