select user_id, t1.room_id, room_type, days from ( select user_id, room_id, DATEDIFF (max(checkout_time), min(checkin_time)) as days from checkin_tb where checkin_time >= '2022-06-12 00:00:00' group by user_id, room_id having days > 1 ) t1 left join guestroom_tb on t1.room_id = guestroom_tb.ro...