SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 17th, 2004, 08:39 PM
braddock braddock is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 braddock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
date range

hi, i have three tables. one is the room table, which can have a number of room rates (room rate table) which are depicted by the hotel season (hotel season table)

is it possible to get what i want from sql or would i need to do it with asp ?

what i would like to do is get the room name, season name, and room rate - when someone has input an arrival date and a departure date.

my tables are as follows (may help)

room_table
-------------
room_id (PK)
hotel_id (FK)
room_name

hotel_season_table
--------------------
hotel_season_id (PK)
hotel_id (FK)
hotel_season_name
hotel_season_start_date
hotel_season_end_date

room_rate_table
--------------------
room_rate_id (PK)
hotel_season_id (FK)
room_id (FK)
room_rate_name
room_rate_amount

Reply With Quote
  #2  
Old August 17th, 2004, 11:17 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
Example:
Code:
SELECT  A.room_name,
	B.hotel_season_name,
	C.room_rate_amount
FROM room_table As A
INNER JOIN hotel_season_table As B On (A.hotel_id = B.hotel_id)
INNER JOIN room_rate_table As C On (B.hotel_season_id = C.hotel_season_id)

There isn't a WHERE clause because I don't know how you are comparing the arrival and departure dates to anything in the database.

Reply With Quote
  #3  
Old August 18th, 2004, 05:12 AM
braddock braddock is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 braddock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up much appreciated

hi thanx for the answer, what i am trying to get is the following.

the hotel room has different rates, as depicted by the season start and end date

so when someone searches for a date range, arrival and departure, i would like it to find out which season the dates are in, then get the rates for the room during that season

even more complex is if the arrival date is before the end of the season and the departure date is after the start of a new season

any kick in the right direction would help !

Reply With Quote
  #4  
Old August 18th, 2004, 12:34 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
The query above will get you started, just add the where clause to check if the dates are between the season begin and season end dates.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > date range


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT