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 |
|
Cyclonik
Posting Yak Master
114 Posts |
Posted - 2006-01-19 : 15:36:29
|
| I need to join multiple tables which have many optional joins. My query is giving me duplicate rows. here is what i have:select * from person a inner join party y on a.PID = y.PID inner join ( select c.PID, e.emailaddress, d.* from pcm c left outer join address d on c.cmid = d.cmid left outer join email e on c.cmid = e.cmid) as X on a.pcid = x.pID Essentially i want everything from the person table inner joined to the party table. Links from the PCM to address and email may or may not exist. So i would like all information in one row with nulls for the columns where there is not corresponding row in the address or email table. I hope thats clear.Any insight? (it's been a while)-=:SpasmatiK:=- |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-01-19 : 15:39:36
|
| Use a LEFT OUTER JOIN to get the rows that do not have matches in the joined table.Tara Kizeraka tduggan |
 |
|
|
|
|
|