Welcome to WebmasterWorld Guest from 54.147.217.76

Forum Moderators: open

Message Too Old, No Replies

select price for a week

   
9:48 am on Dec 20, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, I have a calendar table where I choose arrival and departure dates, those dates gives me 8 days, however the price have to be 7 nights, so I have to rest the last day (think that is the correct, need testing) so I am trying to do this but get error:
SELECT SUM(price_client) FROM calendar_table
WHERE property = 'Casa_Blanca_4'
AND cal_date BETWEEN '2012-01-07' AND date_sub (2011-01-14, interval -1 day)

Also I need to state how many nights there are in the dates and this select works, however I need to add to sum the price:
SELECT TO_DAYS('2012-01-14') - TO_DAYS('2012-01-07') as nights FROM calendar_table
WHERE property = 'Casa_Blanca_4'
AND cal_date BETWEEN '2012-01-07' AND '2012-01-14'
Thanks in advance