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)
 Duplicate data

Author  Topic 

vipin_jha123
Starting Member

31 Posts

Posted - 2011-06-21 : 06:06:38
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
Htd.tran_id as"Tran id ",
gam.foracid as"Account Number",
gam.sol_id as"Branch Code",
gam.schm_code as"Product Code",
htd.tran_date as"Posting Date",
htd.value_date as"Value Date",
htd.tran_sub_type as"Tran Type",
htd.part_tran_type as"Dr/Cr",
htd.tran_amt as"Transaction Amount",
htd.crncy_code as"Tcn CCY",
htd.instrmnt_num as"Inst No",
htd.tran_particular as"Tran Desc ",
cmg.pan_gir_num as"Pan available ",
(case when AAS.acct_poa_as_rec_type='J' then 'Y' else ''end)as"Joint A/c Flg",

gam.acct_opn_date as"Acct open Date",
(Case When GAM.frez_code <> '' Then 'FREEZED' Else (Case GAM.acct_cls_flg
When 'Y' Then 'CLOSED' Else (Case SubString(gam.schm_code, 1, 3)
When 'SBA' Then SMT.acct_status When 'CAA' Then SMT.acct_status
When 'ODA' Then CAM.acct_status When 'CCA' Then CAM.acct_status End)
End) End) As "ACCOUNT STATUS CODE",
gam.clr_bal_amt as"Available Balance",
htd.rcre_user_id as"Maker Id ",
htd.lchg_user_id as"Checker ID ",
sol.sol_desc as"Branch_Name",
htd.dth_init_sol_id as"Transaction_Branch",
gam.cif_id as"cif id ",
htd.tran_date ,
gam.sol_id,
gam.schm_code,
htd.tran_amt

from
gam left join htd on GAM.acid = HTD.acid and GAM.bank_id = HTD.bank_id
inner join cmg on GAM.cif_id = CMG.cif_id and GAM.bank_id = Cmg.bank_id
inner join smt on GAM.acid = SMT.acid and GAM.bank_id = SMT.bank_id
left outer join cam on GAM.acid = CAM.acid and GAM.bank_id = CAM.bank_id
left join tam on GAM.acid = TAM.acid and GAM.bank_id = TAM.bank_id
left join SOL on GAM.SOL_ID = SOL.SOL_ID and GAM.BANK_ID=SOL.BANK_ID
left join AAS on GAM.BANK_ID=AAS.BANK_ID and GAM.ACID=AAS.ACID
where
GAM.del_flg ='N' and
GAM.entity_cre_flg ='Y' and
Cmg.del_flg ='N' and
CMG.entity_cre_flg ='Y' and
HTD.del_flg = 'N'

plz help me

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-21 : 06:59:00
Without table structure and sample data it isn't possible to help - sorry.


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

vipin_jha123
Starting Member

31 Posts

Posted - 2011-06-21 : 07:41:31
Dear Frnd ,
there are 8 table in picture.
please look the relationship and suggest me where i am wrong


thankx
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-21 : 07:44:08
I will capitulate...


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

vipin_jha123
Starting Member

31 Posts

Posted - 2011-06-21 : 07:46:55
ok sir,
plz do the needful help
Go to Top of Page
   

- Advertisement -