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 |
|
magyartoth
Starting Member
1 Post |
Posted - 2005-06-15 : 14:12:11
|
| I'm writing an ASP page for a project and it requires multiple queries. However, I'm trying to combine multiple SELECT statements, but can't figure out a way that actually works.Basically, here are the SELECT statements I want to combine:SELECT * FROM schoolrequest WHERE SLid=10SELECT SLlastName FROM academicofficeWHERE schoolrequest.SLsendToId=academicoffice.AOidSELECT SLlastName FROM academicofficeWHERE schoolrequest.SLbillToId=academicoffice.AOidSELECT SLlastName FROM academicofficeWHERE schoolrequest.SLrequestorId=academicoffice.AOidSELECT * FROM diaryentry WHERE diaryentry.DEkeyValue=10AND diaryentry.DEdeletedDate IS NULLThe academicoffice table just contains basic contact info, but needs to be used 3 times in the query to get specific contact info for 3 different contacts(SLsendToId, SLbillToId, SLrequestorId)The diaryentry table contains info entered in by students. The DEkeyValue is actually the primary id of the schoolrequest table(SLid).Any ideas? Thanks,M |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-06-15 : 21:59:46
|
| Have you looked at UNION and JOIN in Books Online yet?MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|