顺丰大数据挖掘及分析第二道sql题

 不确定对不对,时间很紧,只能写什么交什么了。。。
select g.Userid,g.Class,g.Classnum,f.mainclass
from
(select Userid,Class,count(Class) as Classnum
from waybill_constype
where Consign_day >= "20180401" and Consign_day <="20180430"
group by Userid,Class) g
left join
(select e.Userid,e.mainclass
from
(select d.Userid,
case 
  when d.Classnum = d.maxnum  then d.Class
  else null
end as mainclass
(select c.Userid,c.Class,c.Classnum,d.maxnum
from
(select Userid,Class,count(Class) as Classnum
from waybill_constype
where Consign_day >= "20180401" and Consign_day <="20180430"
group by Userid,Class) c
left join 
(select a.Userid,max(a.Classnum) as maxnum
from 
(select Userid,Class,count(Class) as Classnum
from waybill_constype
where Consign_day >= "20180401" and Consign_day <="20180430"
group by Userid,Class) a
group by a.Userid) b
on c.Userid = b.Userid) d) e
where e.mainclass != null) f
on g.Userid = f.Userid#数据挖掘#
全部评论
我有块错了,那里应该是is not null,而不是!=null  难受。。。。。。。
点赞 回复 分享
发布于 2018-09-17 21:06
题目还记得吗?我看看?
点赞 回复 分享
发布于 2018-09-17 20:59

相关推荐

评论
点赞
9
分享

创作者周榜

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