2,3跑通了,第一题怎么也调不对,求大神指点,下面是1,2题,第三题忘了粘过来了。。。 --1 select b.channel_type as '渠道类型',sum(a.cishu)/count(a.uid) as '人均观看次数', round( ((sum(case when date='20190711' then a.cishu else 0 end) / count(case when date='20190711' then a.uid else null end)) -(sum(case when date='20190710' then a.cishu else 0 end) / count(case when date='20190710' then a.uid else null end))), 4) as '涨幅' from ( select date,uid,count(*) as cishu from user_video where date in ('20190710','20190711') group by 1,2 )a left join ( select uid,channel_type from new_user_info )b on a.uid=b.uid group by 1 --2 select c.uid from ( select a.uid as uid,sum(case when dt>='20190801' and dt<='20190807' then b.cishu else 0 end) as seven, sum(case when dt='20190808' then b.cishu else 0 end) as eight from (select uid from user_info where gender='女' and age<='25')a left join (select uid,date as dt,count(*) as cishu from user_video where tag='美食' and date>='20190801' and date<='20190808' group by 1,2)b on a.uid=b.uid group by 1 )c where c.seven>10 and c.eight<3
点赞 评论

相关推荐

02-16 13:52
门头沟学院 Java
给🐭🐭个面试机会吧:嘿,mvbatis
点赞 评论 收藏
分享
牛客网
牛客企业服务