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 # 离谱的顺序表达