首先利用笛卡尔积制作一个表来存储连续两天都购物的人uid和其时间 with tb(uid,day1,day2) as ( select distinct * from ( select a.user_id,a.sales_date day1,b.sales_date day2 from (select user_id,sales_date from sales_tb) a ,(select user_id,sales_date from sales_tb)b where a.sales_date+1 = b.sales_date and a.user_id = b.user...