select c.user_id,c.room_id,c.room_type,c.days
from (select b.user_id,a.room_id,a.room_type,datediff(b.checkout_time,b.checkin_time) as days
from checkin_tb as b left join guestroom_tb as a
on b.room_id=a.room_id) as c
where c.days>1
order by c.days asc
问题就在于后面的排序了