题解 | #查询连续入住多晚的客户信息?#
查询连续入住多晚的客户信息?
https://www.nowcoder.com/practice/5b4018c47dfd401d87a5afb5ebf35dfd
select ct.user_id,ct.room_id, gt.room_type, datediff(checkout_time, checkin_time) as days from guestroom_tb as gt inner join checkin_tb ct on gt.room_id = ct.room_id where datediff(checkout_time, checkin_time) > 1 order by days asc,ct.room_id asc ,user_id desc # 离谱的顺序表达