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

京公网安备 11010502036488号