select user_id,sum(gap)+1 from (select user_id, timestampdiff(day,sales_date,nextday) as gap from (select user_id,sales_date, &n...