select c.user_id, c.room_id, g.room_type, datediff(checkout_time, checkin_time) as days from checkin_tb c join guestroom_tb g using(room_id) where checkin_time >= "2022-06-12" having days > 1 order by days,c.room_id,c.user_id desc

select c.user_id, c.room_id, g.room_type, datediff(checkout_time, checkin_time) as days from checkin_tb c join guestroom_tb g using(room_id) where checkin_time >= "2022-06-12" having days > 1 order by days,c.room_id,c.user_id desc