题解 | #每类视频近一个月的转发量/率#

每类视频近一个月的转发量/率

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

select 
      b.tag
     ,count(if(a.if_retweet = 1,1,NULL)) as retweet_cut
     ,round(count(if(a.if_retweet = 1,1,NULL))/count(1),3) as retweet_rate 
from tb_user_video_log as a inner join tb_video_info as b 
on a.video_id = b.video_id
where TimeStampDiff(day,start_time,(select max(start_time) from tb_user_video_log)) < 30
group by b.tag
order by retweet_rate desc
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务