select user_id,room_id,room_type,days
from (
select
user_id,a1.room_id as room_id,room_type,
datediff(date(checkout_time),date(checkin_time)) as days
from checkin_tb a1
left join guestroom_tb a2
on a1.room_id=a2.room_id
) t1
where days>=2
order by days, room_id, user_id desc

题目排序要求写得不全,看结果应该是days, room_id, user_id desc