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 - 2002-08-13 : 13:08:21
|
| jane writes "Hi Gurus,I know what records I want from the db, but I just don't know how to form the queries to retrieve it.Basically, I need info from 3 tables:contact_tblbusiness_tblhistory_tblthe relationship between contact_tbl and business_tbl is 1 to manythe relationship between business_tbl and history_tbl is 1 to manyI first need to retrieve all the business records that pertain to a certain contact and then from THAT recordset I need to retrieve all the history items that pertain to a certain businessPlease help!Thank you,Jane" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-08-13 : 13:41:54
|
Look up JOIN in Books Online.It's gonna end up being something like ...select <column list>from business_tbl b inner join contact_tbl c on c.<primary key> = b.<foreign key> inner join history_tbl h on b.<primary key> = h.<foreign key> Is the "_tbl" naming convention really necessary?Jay White{0} |
 |
|
|
|
|
|