There are 2 tables in SQL 2008 having nomenclature as VSDA & CBSDA & I am mathcing them to get exact results
------------ To match 3 conditions & Create temporary table #Cond3Match
------------ To match 3 conditions & Create temporary table #Cond3Match
Code:
SELECT b.srno, A.BUS_DATE,A.amount, a.chk_num, a.rt_num, a.seq_num,
b.ENTRYDATE,b.InstrumentAmt,b.InstrumentNumber, b.MICR
into #Cond3Match from VSDA a join CBSDA b on
A.amount = b.InstrumentAmt and a.chk_num = b.InstrumentNumber and a.rt_num = b.MICR
[code]
----------- After creating above table when I found duplicate records
[code]
SELECT * from #Cond3Match a inner join
(select amount,chk_num,rt_num,srno from #Cond3Match
group by amount,chk_num,rt_num, srno having COUNT(*)>1) b on a.amount = b.amount and a.chk_num = b.chk_num
and a.rt_num=b.rt_num and a.srno = b.srno where b.srno is not null
order by a.amount,a.chk_num,a.rt_num
[code]
The records match & extract in #Cond3Match is not exact, I want that if duplicate in both table then I must get case to case record. It means if system matched 1st record then for second record it must search from rest records & going on……..
I need the query on very very urgent basis.
Thanks in advance for help.
Last edited: