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
 Duplicate records when using left join on 3 table

Author  Topic 

Sam_Ura
Starting Member

1 Post

Posted - 2009-12-12 : 14:51:02
Hiya all,
i have a question relating using join on 3 tables. This is my situation:
- i have 3 tables, this is short desc. of its structures and some
fields:
Table1(material(PK), title, field1, field2)
Table2(material, in_stock, field1, field2, field3)
Table2(material, orders, field1, field2, field3)

If i do LEFT JOIN with table1 and table2 on material i get one part of the result i need,
if If i do LEFT JOIN with table1 and table3 on material i get the second half of the results...
but if i do left join on all three tables i get some duplicates.

The question i have is, how can i remove this duplicates?

Thnx.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-12-12 : 17:11:15
I think we need to see the data that build the duplicates...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-14 : 01:28:23
Also post the code you used

Madhivanan

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

- Advertisement -