match exact records in sql

sanjuss2

Board Regular
Joined
Nov 28, 2014
Messages
65
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
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:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,491
Messages
6,125,098
Members
449,205
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top