题解 | 查询连续入住多晚的客户信息?
SELECT b.user_id,
b.room_id,
a.room_type,
datediff(b.checkout_time,b.checkin_time) as days
FROM guestroom_tb a
lEFT JOIN checkin_tb b
on a.room_id=b.room_id
where b.checkin_time>='2022-06-12'
and datediff(b.checkout_time,b.checkin_time)>=2
order by datediff(b.checkout_time,b.checkin_time) ASC,
b.room_id asc,
b.user_id desc
#连续入住多晚,连续2次
#排序
