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

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

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

SELECT
    B.user_id,
    B.room_id,
    A.room_type,
    DATEDIFF (checkout_time, checkin_time) AS days
FROM
    guestroom_tb A
    JOIN checkin_tb B ON A.room_id = B.room_id
WHERE
    DATEDIFF (checkout_time, checkin_time) > 1
ORDER BY
    DATEDIFF (checkout_time, checkin_time)ASC,B.room_id ASC,B.user_id DESC

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-26 18:54
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务