Click here to Skip to main content
15,888,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Can somebody help me with my code? I am getting multiple duplicate values. I tried "group by", but it gives me error message.

Thanks

Following is the query

SELECT top 10
a.IGFACNAM1 as Name,
a.IGFID# as Id_Num,
a.IGFIDTYP as Id_Type,
a.IGFCIF# as Cif_No,
a.IGFAC# as Acc_No,
c.Occp_Nm1 as Occupation,
a.IGAPPIBCD as Income_Level,-- as Income_Level ?
a.IGMSGID + '- '+ a.IGPDTL1 as Trascation_Code_BDS,
a.IGVALDT as Transaction_Date,
count(*) TotalCount,
a.IGTAMT as Transaction_Amount,
--count daily transaction ?
--count(a.IGFAC#) as Daily_Transaction,
a.IGFRMMBR + '-' + h.Branch_NM1 as Transaction_Branch,
e.ResdFG_Nm as Resident,
a.IGTOMBR as Beneficiary_Bank,
f.State_NM1 as State,
g.Risk_NM1 as AML_CFT_Risk_Level
from [DW_EDM_BPM].[dbo].[IBG] a
left outer join [DW_EDM_BPM].[dbo].[m4cus] b on
a.IGFACNAM1 = b.Cus_NM1
left outer join [DW_EDM_BPM].[dbo].[pOccp] c on
b.Occp_ID = c.Occp_ID
left outer join  [DW_EDM_BPM].[dbo].[qResd] e on
b.Resd_FG = e.Resd_FG
left outer join [DW_EDM_BPM].[dbo].[pState] f on
b.State_ID = f.State_ID
left outer join [DW_EDM_BPM].[dbo].[pRisk] g on
b.Risk_ID = g.Risk_ID
left outer join [DW_EDM_BPM].[dbo].[pBranch] h on
cast(b.Branch_ID as varchar)  = h.Branch_ID
where a.IGTAMT >= 50000
Posted
Updated 16-Dec-10 15:40pm
v2

1 solution

Use DISTINCT[^] statement to remove duplicates.
 
Share this answer
 
Comments
ladyhahn 16-Dec-10 21:45pm    
i tried distinct before,but it still gives me duplicate,since i have join many tables into it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900