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 |
|
laptop545
Starting Member
11 Posts |
Posted - 2010-01-13 : 17:31:20
|
| I have two SQL tables, each of which contains the following columns:userId, name , address , numberuserId field is uniquethe userIds in both tables are the same, but the rest of the data may not be (e.g. table1 may have Mark as the name while table2 might have Robert)the rows are not guaranteed to be in the same order in both tables.1) can anyone tell me how to write a query which will return the userId and the number of matching fields (i.e. if name, address AND number are the same in both tables, it returns 3; if only the name and address is correct but the number is wrong it returns 2; if only the name matches it returns a 1; if only the number matches it returns a 1; etc) |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
|
|
|
|
|