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 |
natg504
Starting Member
14 Posts |
Posted - 2005-09-08 : 10:14:47
|
I'm trying to join two sets of data to create a recordset in ASP. One is a full table Select * from tblTimeSlotsThe other is a query that returns only rows between a range of dates from a different table SELECT *FROM tblScheduleWHERE slotDt<=weekStartAND slotDt>=weekEnd;I want to join the two sets of data on a field called slotID that is in both tables. I would like every row in tblTimeSlots to be returned, and if there is any data for that slotID in the query of tblSchedule, i would like those fields to show up too. I could get this to work in Access with something like SELECT tblTimeSlots.*, scheduledThisWeek.*FROM tblTimeSlots LEFT JOIN scheduledThisWeek ON tblTimeSlots.slotID = scheduledThisWeek.slotID;but, I'd like to be able to do it all in one statement in the ASP if that is possible. Does anyone have any suggestions on how to do this?? THanks! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-09-08 : 13:30:31
|
So why can't you use your JOIN query:SELECT tblTimeSlots.*, scheduledThisWeek.*FROM tblTimeSlots LEFT JOIN scheduledThisWeek ON tblTimeSlots.slotID = scheduledThisWeek.slotID That's all in one statement. You just need to add your WHERE clause to it.Tara |
 |
|
|
|
|