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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Getting duplicate data

Author  Topic 

vipin_jha123
Starting Member

31 Posts

Posted - 2011-06-22 : 02:26:40
Dear All ,
Please help me as its very urgent for me ..

Iam getting duplicate data usig my qyery
please suggest necessery changes in my query

my query is :-

select gam.foracid as"GL Acct Number",
gam.acct_name as"GL Acct Name",
gam.foracid as"Second Leg Acct Number",
htd.tran_date as"Tran Date",
htd.value_date as" Value Date ",
htd.part_tran_type as"Dr/Cr",
HTD.RATE*HTD.TRAN_AMT as"Tran Amt in Local CCY",
htd.tran_amt as"Tran amt in Acct CCY",
htd.tran_particular as"Transaction Particular",
htd.tran_id as" Tran id ",
htd.rcre_user_id as"Maker id ",
htd.lchg_user_id as"checker id",
htd.dth_init_sol_id as"Initiating Sol id",
gam.sol_id

from GAM left outer join htd on
GAM.acid = HTD.acid and GAM.SOL_ID = HTD.SOL_ID

where GAM.del_flg ='N' and
GAM.entity_cre_flg ='Y' and
HTD.del_flg ='N'


Table structure is

table name GAM
Common column-acid,bank_id,sol_id
table name 2-HTD
Common column-acid,bank_id,sol_id


PLESAE advise me the proper relationship so that i can get a uniquw data


regards,
Vipin jha

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-22 : 02:34:14
Your statement looks ok.

Are there really duplicate rows or are they different in some columns?

Maybe there are more than one matching row in HTD for each row in GAM, then it is normal to have "duplicates" in the result set.


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

- Advertisement -