题解 | #连续签到领金币#

连续签到领金币

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

select uid,month,sum((case when nums%7>=3 then 2 else 0 end)+floor(nums/7)*8+nums)as coin
from 
(select uid,date_format(d,'%Y%m')as month,count(ct)as nums
from 
(select d,uid,num,(d-num)as ct
from 
(select distinct date(in_time)as d,uid,
row_number()over(partition by uid order by in_time)as num
from tb_user_log
where artical_id=0 and date(in_time)between '2021-07-07' and '2021-10-31' and sign_in=1)t1)t2
group by uid,month,ct)t3
group by uid,month
order by month,uid
全部评论

相关推荐

不愿透露姓名的神秘牛友
11-26 16:06
已编辑
快手电商 后端 23k-35k
点赞 评论 收藏
分享
11-15 19:28
已编辑
蚌埠坦克学院 硬件开发
点赞 评论 收藏
分享
评论
1
收藏
分享
牛客网
牛客企业服务