全部评论
欢迎各位大佬指正 1. select a.type, sum(a.vnum)/count(a.uid) as avg,
round(
sum(case when a.date='20180711'then a.vnum else 0 end)/count(distinct case when a.date='20180711'then a.uid else null end)
-sum(case when a.date='20180710' then a.vnum else 0 end)/count(distinct case when a.date='20180710'then a.uid else null end),
4)as increase
from(
select v.date as date, v.uid as uid, v.vid as vid,
info.channel_type as type, count(vid) as vnum from
user_video as v left join new_user_info as info on v.uid=info.uid
where v.date in ('20180710','20180711')group by date,uid,type
)a
group by a.type; 2. select uid from(
select a.date,a.uid,
sum(if(date>='20190801'and date<='20190807',1,0))as num1,
sum(if(date='20190808',1,0))as num2
from(
select v.date,v.uid from user_video v join user_info i on
v.uid=i.uid
where v.tag='美食' and i.age<=25 and i.gender='女'
)a group by a.uid
)b where b.num1>10 and b.num2<3;
3. select a.tag,max(a.num)-min(a.num)from(
select tag,uid,count(distinct vid) as num from user_video group by tag,uid
) a
group by a.tag;
相关推荐
10-11 12:13
湖北工业大学 Java 点赞 评论 收藏
分享
CUG芝士圈:虽然是网上的项目,但最好还是包装一下,然后现在大部分公司都在忙校招,十月底、十一月初会好找一些。最后,boss才沟通100家,别焦虑,我去年暑假找第一段实习的时候沟通了500➕才有面试,校友加油
点赞 评论 收藏
分享