题解 | 查询连续入住多晚的客户信息?
查询连续入住多晚的客户信息?
https://www.nowcoder.com/practice/5b4018c47dfd401d87a5afb5ebf35dfd
with t as (select ct.room_id,user_id,datediff(date(checkout_time),date(checkin_time)) as days,room_type from checkin_tb ct left join guestroom_tb gt on gt.room_id = ct.room_id) select user_id,room_id,room_type,days from t where days >=2 order by days asc,room_id asc,user_id desc
查看10道真题和解析