This is a simple query I've wrote for finding Customer Information.There are duplication in this query if the more than one contact persons entered to the fields(OCPR) .How can i avoid this from the output??Please see the sample output attached for any reference. SELECT T0.[CardCode], T0.[CardName],OCRG.GroupName,T0.Password AS 'Product& Year',OSHP.TrnspName as 'Constitution',CRD7.TaxId0,CRD7.TaxId1,CRD7.TaxId11,CRD7.ECCNo,CRD7.CERegNo,CRD7.CERange,CRD7.CEDivis,CRD7.CEComRate,OOND.IndName,OSLP.SlpName, T1.[Name],T1.[FirstName], T1.[MiddleName], T1.[LastName], T1.[Position], T1.[Address], T1.[Tel1], T1.[Tel2], T1.[Cellolar], T1.[Fax], T1.[E_MailL], T1.[Pager], T1.[Notes1] as 'Bday', T1.[Notes2] as 'Wedding' FROM OCRD T0 INNER JOIN OCPR T1 ON T0.CardCode = T1.CardCode INNER JOIN OSLP ON T0.SLPCODE = OSLP.SLPCODE INNER JOIN OCRG ON T0.GroupCode = OCRG.GroupCode INNER JOIN OOND ON T0.IndustryC = OOND.IndCode INNER JOIN CRD7 ON T0.CardCode = CRD7.CardCode INNER JOIN OSHP ON T0.ShipType = OSHP.TrnspCode WHERE T0.CardType = '[%0]'
Hi Nabil,
I think the only way not to duplicate the row in your output is to delete the other contact saved in your OCPR table..
Regards.
Hi Nabil.
Write sub query for the contact person instead of linking to main query...
You can also use distinct but no use i think...
Cheers!
Add a comment