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
 General SQL Server Forums
 New to SQL Server Programming
 Join

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-09-16 : 14:01:50
I created this join, but I also need to add in 1 more table and link it to a table that is already in a join. I need to add pcsp_id1 = pcsa_id1(which the pcsa table already exists, How would I do this?

JOIN prop dgh
ON pro.pro_id1 = dgh.prop_id1 AND dgh.prop_prd = 'DGH'
LEFT JOIN pcsa
ON pro.pro_id1 = pcsa_id1 and pcsa_Stat NOT IN ('NOGOOD') and on pcsp_pcsp_id1 = pcsa_id1

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-09-16 : 15:25:29
Your question is not clear but...
You can correlate one or more columns from the new table to any table.column that has already been JOINed.

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-17 : 00:15:25
quote:
Originally posted by werhardt

I created this join, but I also need to add in 1 more table and link it to a table that is already in a join. I need to add pcsp_id1 = pcsa_id1(which the pcsa table already exists, How would I do this?

JOIN prop dgh
ON pro.pro_id1 = dgh.prop_id1 AND dgh.prop_prd = 'DGH'
LEFT JOIN pcsa
ON pro.pro_id1 = pcsa_id1 and pcsa_Stat NOT IN ('NOGOOD') and on pcsp_pcsp_id1 = pcsa_id1
LEFT JOIN nexttablenamehere n
on n.pcsp_id1 = pcsa.pcsa_id1



may be like above
Go to Top of Page
   

- Advertisement -