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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Pulling info from 3 tables

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-02-21 : 22:23:13
I have 3 tables and the only thing they shar is each has a coulmn named player id. How do I pull all the info from all 3 tables at one time? I know how to use an inner join on 2 tables but not 3.

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-21 : 23:35:43
SELECT * FROM Table1 A
INNER JOIN Table2 B ON A.PlayerID=B.PlayerID
INNER JOIN Table3 C ON A.PlayerID=C.PlayerID


You have the option of joining B and C together, instead of A and C, since these are inner joins they would be equivalent. I would suggest that if the column(s) being joined are primary key in a table, that table should be used in the join conditions as much as possible, as it will be more likely to utilize the index.

Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-02-22 : 15:08:19
Would doing an innner joins let me update coulmns in all 3 tables?

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-22 : 16:04:44
No. UPDATEs can only modify one table at a time, whether you join them or not.

Go to Top of Page
   

- Advertisement -