with temp1 as (SELECT '2021-10-01' dt, DATE_FORMAT(start_time,'%Y-%m') date,tag,sum(if_like) sum_like_cnt_7d, SUM(if_retweet) as max_retweet_cnt_7d
from 
tb_user_video_log a JOIN tb_video_info b USING(video_id)
WHERE start_time BETWEEN '2021-09-25' and '2021-10-01 23:59:59'
GROUP BY tag,start_time),
temp1_1 as  (SELECT tag,dt, sum(sum_like_cnt_7d) as sum_like_cnt_7d,max(max_retweet_cnt_7d) as max_retweet_cnt_7d from temp1 
GROUP BY tag),

temp2 as (SELECT '2021-10-02' dt, DATE_FORMAT(start_time,'%Y-%m') date,tag,sum(if_like) sum_like_cnt_7d, SUM(if_retweet) as max_retweet_cnt_7d
from 
tb_user_video_log a JOIN tb_video_info b USING(video_id)
WHERE start_time BETWEEN '2021-09-26' and '2021-10-02 23:59:59'
GROUP BY tag,start_time),
temp2_1 as  (SELECT tag, dt,sum(sum_like_cnt_7d) as sum_like_cnt_7d,max(max_retweet_cnt_7d) as max_retweet_cnt_7d from temp2 
GROUP BY tag),

temp3 as (SELECT '2021-10-03' dt, DATE_FORMAT(start_time,'%Y-%m') date,tag,sum(if_like) sum_like_cnt_7d, SUM(if_retweet) as max_retweet_cnt_7d
from 
tb_user_video_log a JOIN tb_video_info b USING(video_id)
WHERE start_time BETWEEN '2021-09-27' and '2021-10-03 23:59:59'
GROUP BY tag,start_time),
temp3_1 as  (SELECT tag, dt,sum(sum_like_cnt_7d) as sum_like_cnt_7d,max(max_retweet_cnt_7d) as max_retweet_cnt_7d from temp3
GROUP BY tag)

select *
from (select * from temp1_1 union all select * from temp2_1 union all select * from temp3_1) as m
order BY tag desc, dt