#梳理表格&需求颗粒度
#guestroom_tb room_id
#checkin_tb room_id+user_id+checkin_time
#需求 user_id+room_id
select
c.user_id
,c.room_id
,g.room_type
,abs(datediff(checkin_time,checkout_time)) as days
from checkin_tb c
left join guestroom_tb g
on c.room_id = g.room_id
where date(checkin_time)>='2022-06-12'
and abs(datediff(checkin_time,checkout_time))>1
order by days,room_id,user_id desc;

有一说一,这题出的挺烂的