题解 | 查询连续入住多晚的客户信息?

查询连续入住多晚的客户信息?

https://www.nowcoder.com/practice/5b4018c47dfd401d87a5afb5ebf35dfd

select t1.user_id,t1.room_id,g.room_type,t1.days
from(
    select *, datediff(checkout_time,checkin_time) as days
    from checkin_tb

) as t1
left join guestroom_tb g on t1.room_id = g.room_id
where t1.days>1
order by t1.days asc,t1.room_id asc,t1.user_id desc

全部评论

相关推荐

牛客41077653...:想问一下华为池子是不是很大呀
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务