|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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 ! |
|
#4
|
||||
|
||||
|
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.
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > date range |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|