select     count(distinct(user_id)) from (     select         user_id,         dt,         lead(dt,2,'1970-01-01') over(partition by user_id order by dt) lead2     from tbl )t1 where datediff(lead2,dt)=2 &&where order_num>100; //三天连续老经典题了,字段有问题,你自己调试