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
 Remove duplicate records

Author  Topic 

mavericky
Posting Yak Master

117 Posts

Posted - 2011-08-10 : 20:32:18
Hi all,
This is my query. It is returning duplicate records.
SELECT * FROM Program P
INNER JOIN WholesaleProduct W
ON P.WholesaleProductID = W.ID
INNER JOIN AssetType AT
ON AT.ID = P.AssetTypeID
INNER JOIN AssetProfile AP
ON AT.ID = AP.AssetTypeID
INNER JOIN Asset A
ON A.AssetTypeID= AT.ID ( I understand that duplicates are because of join of AssetType.ID twice)

Till this part it works fine.
SELECT * FROM Program P
INNER JOIN WholesaleProduct W
ON P.WholesaleProductID = W.ID
INNER JOIN AssetType AT
ON AT.ID = P.AssetTypeID

I want to return only relevant records. Can anyone help me?

Thanks in anticipation,
Mavericky

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-08-11 : 02:39:48
Without examples we can't see what you would identify as duplicates.


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

- Advertisement -