题解 | #国庆期间每类视频点赞量和转发量#

连续签到领金币

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

SELECT uid, DATE_FORMAT(dt,'%Y%m') month, sum(day_coin) coin from (SELECT *, DATE_SUB(dt,INTERVAL rn day) dt_tmp, case DENSE_RANK() over(PARTITION BY DATE_SUB(dt,INTERVAL rn day),uid ORDER BY dt )%7 WHEN 3 THEN 3 WHEN 0 THEN 7 ELSE 1 END as day_coin from (SELECT DISTINCT uid, DATE(in_time) dt, DENSE_RANK() over(PARTITION BY uid ORDER BY DATE(in_time)) rn -- 编号 FROM tb_user_log WHERE DATE(in_time) BETWEEN '2021-07-07' AND '2021-10-31' AND artical_id = 0 AND sign_in = 1 ) t1) t2 GROUP BY uid, DATE_FORMAT(dt,'%Y%m') ORDER BY DATE_FORMAT(dt,'%Y%m'),uid

全部评论

相关推荐

河和静子:如果大专也能好过的话,我寒窗苦读几年的书不是白读了?
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
11-21 17:16
科大讯飞 算法工程师 28.0k*14.0, 百分之三十是绩效,惯例只发0.9
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务