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
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)