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)
 Join with 3 tables

Author  Topic 

Lainkes
Starting Member

3 Posts

Posted - 2008-02-04 : 09:33:09
Hey,

I have following tables :

Person : P_ID, ... (contains person information).
Dossier : P_ID, DOS_ID, ... (contains dossier information).
Each person can have more than 1 dossier.

Test : DOS_ID, .... (test information).
each dossier has 1 corresponding test record.

I want to make a query that returns for each person all test dossiers.

Any idea how I can do that?

Thanks in advance

Greetings

Lainkes

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-04 : 09:38:17
SELECT *
FROM Person p
INNER JOIN Dossier d
ON d.P_ID=p.P_ID
INNER JOIN Test t
ON t.DOS_ID=d.DOS_ID
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-04 : 09:39:18
Also make sure to specify required columns in the select statement

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -