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 |
Ratz03
Starting Member
27 Posts |
Posted - 2014-11-13 : 11:51:39
|
Hello,COuld anyone please assist in writing a stored proc or query that will help reconcile records in two tablesThe query should return only rows where there are mismatches in column salary. Table 1 Name Age Salary Bo ABC 10 100 11 XYZ 11 20 33 TYU 12 900 65 IDE 10 654 66 Table 2 Name Age Salary BonusABC 10 100 11XYZ 11 98 33TYU 12 980 65IDE 10 666 66 Result Name Age Salary Bonus Table 1 Table 2 Table 1 Table 2 Table 1 Table 2 Table 1 Table 2 XYZ XYZ 11 11 20 98 33 33 TYU TYU 12 12 900 980 65 65 IDE IDE 10 10 654 666 66 66 |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-13 : 12:05:37
|
[code]select t1.*, t2.*from table1 t1join table2 t2 on t1.name = t2.name and t1.salary <> t2.salary[/code] |
|
|
|
|
|