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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-07-08 : 12:03:04
|
Dennis writes "I do not know if I can explain my problem properly. but I'll give it a try. I have 4 Tables a Volunteer table, an Assignment (Master Table) and an Assignment_Detail (Detail Table).And a Join Table that holds the Keys to each table. ie: VolID, ItemID,DetailID I would like to know how to create a select statement that would return a result that would populate a datalist displaying the Volunteers Name, Email etc for the Volunteer Table, and for the master-detail tables the Title of the Assignment, Description, etc; from the Assignment Table and the details of the Assignment like Date and Time periods that the Volunteer signed up for. The VolID get the Volunteer Data and the ItemID get the Master Data and the (ItemID and DetailID) gets the Detail Data. Can someone give me some help on creating the proper way to do this. The Join Table looks like This ID VolID ItemID DetailID1 John 1 1 2 John 1 43 John 3 24 Den 10 15 Den 1 16 Mary 7 27 Mary 1 2 " |
|
|
JasonGoff
Posting Yak Master
158 Posts |
Posted - 2004-07-09 : 04:53:46
|
Something like...SELECT V.*, A.*, D.*FROM Volunteer VINNER JOIN JoinTable J ON J.VolID=V.VolIDINNER JOIN Assignment A ON A.ItemID=J.ItemIDINNER JOIN Detail D ON D.DetailID=J.ItemID obviously without a full schema for all the tables I'm not sure the column names etc are correct, but you get the idea. |
 |
|
|
|
|
|