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-05-23 : 10:37:11
|
| david writes "how would I do this?I have 3 tables: table1: IDtable2:ID, UPCtable3:UPC, NAMEthere is a one to many relationship between table1.id and table2.id and also a one to many between table3.upc and table2.upc.i need to look up the name in table3, based on the upc in table 2, which is based on the id in table 1. for example if there is an id of 1 in table1, select all of the id's of 1 in table2, then take the corresponding upc's for id of 1. and lookup the names for the upc's in table3. I hope you can help thanx." |
|
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-05-23 : 10:53:59
|
| I think select ttt.name ,t.idfrom table1 t inner join table2 tt on t.id = tt.idinner join table3 ttt on tt.upc = ttt.upcwhere t.id = 1should show all the names (plz correct me if I'm wrong). Your result set may get rather large..Edited by - M.E. on 05/23/2002 10:57:33 |
 |
|
|
|
|
|