Hotel Booking Rates SQL Problem

后端 未结 3 583
清歌不尽
清歌不尽 2021-01-16 07:33

Hi I\'ve been trying to get my own system for checking rooms rates going after reading other questions here on StackOverflow.

My query works fine and produces corre

3条回答
  •  没有蜡笔的小新
    2021-01-16 08:03

    If I understand your algorithm correctly, you want to include first day even partially, so I would suggest you to use instead of + 1 for each rate do this only for the first one.

    Try to use this (MSSQL):

    + CASE WHEN rate_start_date <= '2011-04-14 12:00:00' THEN 1 ELSE 0 end
    

    or (MYSQL):

    + IF (rate_start_date <= '2011-04-14 12:00:00', 1 ,0)
    

提交回复
热议问题