题解 | #某宝店铺连续2天及以上购物的用户及其对应的天数#
https://www.nowcoder.com/practice/63ac3be0e4b44cce8dd2619d2236c3bf
select user_id, num from ( select user_id, count(*) num from ( select user_id, date_sub(sales_date,interval row_number() over(partition by user_id order by sales_date) day) dt from ( select user_id, sales_date from sales_tb group by user_id,sales_date )t1 )t2 group by user_id,dt )t3 where num >= 2 order by user_id