select user_id,g.room_id,room_type,
date(checkout_time)-date(checkin_time) as days
from guestroom_tb as g
join
(
select room_id,user_id,checkin_time,checkout_time from checkin_tb
) as c 
on g.room_id = c.room_id
where date(checkout_time)-date(checkin_time) >= 2
order by days asc,g.room_id asc,user_id desc