homepage Welcome to WebmasterWorld Guest from 54.145.183.190
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
select price for a week
helenp

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4399653 posted 9:48 am on Dec 20, 2011 (gmt 0)

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

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved