Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dude131
Starting Member
6 Posts |
Posted - 2005-06-30 : 17:24:20
|
| OK, In access I have 2 SQL statements. One that finds rooms reserved and one that finds rooms available. The second statement referrs to the first one... so in ASP, I'm assuming you would have to refer to the recordset from the first query (is this correct?)Statement1 (Query name is access is Rooms Reserved):strSQl = "SELECT Booking.BookPropID, Booking.BookDateStart, Booking.BookDateEnd FROM Booking WHERE (((Booking.BookDateStart) Between #" & cindate & "# And #" & coutdate & "# -1)) Or ((([BookDateEnd]-1) Between #" & cindate & "# And #" & coutdate & "#)) Or (((Booking.BookDateStart)<#" & cindate & "#) And (([BookDateEnd]-1)>#" & coutdate & "#-1))"Statement2 (Bolded reference to first query):strSQL2 "SELECT Property.PropID FROM Property LEFT JOIN [Rooms Reserved] ON Property.PropID=[Rooms Reserved].BookPropIDWHERE ((([Rooms Reserved].BookPropID) Is Null))" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-01 : 01:11:50
|
| I think you can directly run the second query by passing all the parametersMadhivananFailing to plan is Planning to fail |
 |
|
|
hgorijal
Constraint Violating Yak Guru
277 Posts |
Posted - 2005-07-01 : 02:29:59
|
| Concatenate strSQL into strSQL2 and execute only strSQL2. strSQL2 = "SELECT Property.PropID FROM Property LEFT JOIN (" & strSQL & ") as [Rooms Reserved] ON Property.PropID=[Rooms Reserved].BookPropIDWHERE ((([Rooms Reserved].BookPropID) Is Null))"Hemanth GorijalaI Came. I Saw. I Normalized. |
 |
|
|
dude131
Starting Member
6 Posts |
Posted - 2005-07-01 : 16:09:14
|
| Thanks hgorijal!!!! This works brilliantly. |
 |
|
|
|
|
|