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.
Author |
Topic |
kamalkishore_in
Yak Posting Veteran
76 Posts |
Posted - 2002-03-27 : 01:14:31
|
Hi I have two tables Say TableA and TableB.Structure of the both the tables are same.Table Name : TableAFields are:Code intAmount IntData for TableA isCode, Amount1,1002,2004,400Data for TableB isCode, Amount1,1002,3003,04,400My question is : I wants to match of Code and amount of both tablesTables should exactly match of Data to each other. Looking for the query..Need help. |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-03-27 : 01:17:56
|
You just add an extra condition to your join clause.I.e.SELECT *FROMTableAINNER JOIN TableB ON TableB.Code = TableA.code AND TableB.Amount = TableA.Amount Hope that helpsDamian |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-27 : 08:54:47
|
sql server can also compute checksums for rows and tables. for very large rowsets that might be advantageous - plus you don't have to write specific queries for each table pair comparison.setBasedIsTheTruepath<O> |
|
|
kamalkishore_in
Yak Posting Veteran
76 Posts |
Posted - 2002-03-27 : 20:30:16
|
Hi Dear,I think my question was not very clear.I need to know How many records are not matching. (Count)Waiting... |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-03-27 : 20:41:56
|
Your question was very clear. You just asked the WRONG question. You didn't mention ANYTHING about counting the number that didn't match. SELECT count(*)FROMTableALEFT JOIN TableB ON TableB.Code = TableA.code AND TableB.Amount = TableA.AmountWHERE TableB.Code is NULL quote: Waiting...
That is verging on rude considering YOU made the mistake. Think about it a little more next time.DamianEdited by - merkin on 03/27/2002 20:42:25 |
|
|
|
|
|