Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

My Select Statement is resulting in duplicate records being produced...

Help,


My Select Statement is resulting in duplicate records being produced...

Think it may be something to do with my joins????

Thank you


Select 
P.ID, 
P.[Product-Name], 
LEFT(P.[Product-Description],40)+'..' AS Description, 
Case When P.[Display-TGI-Special-Price]='Y' then DP.[Special-Price] Else DP.[Normal-Price] end AS Price, 
Case When P.[Display-TGI-Special-Price]='Y' then DP.[Normal-Price] end AS  OriginalPrice, 
I.Image, 
P.SKUCode 
from dbo.[Direct-Product] P 
inner join dbo.[Direct-Product-Image] I on I.ProductID = P.ID 
inner join dbo.[Direct-Product-Price] DP on DP.[Product-ID] = P.ID 
left join dbo.[Direct-Product-Category] DPC on DPC.[Product-ID] = P.ID 
left join dbo.[Direct-Category] C on C.ID = DPC.[Category-ID] 
inner join dbo.[Nominal-Codes] NC ON P.NominalCodeID = NC.ID 
Where (C.[Category-label] LIKE 't' OR P.[Product-Name] LIKE 't' OR P.SKUCode LIKE 't'
OR P.[Product-Description] LIKE 't') 
AND P.StockCount >= 1 AND P.[Display-TGI-Direct] = 'Y' 
AND I.[Default-Image] = 'Y'

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of BartVx
BartVx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

thanks both