0

Need only differing rows values from two tables

Like..

ID  Name    Salary
1   ABC     2000
2   XYZ     4000
3   Suresh  6000

ID  Name    Salary
1   ABC     3000
2   XYZ     5000
3   Suresh  6000

If I update first table, here I saved particular row in destination table from source table based on condition, now I want to compare two table's column values.. Which column values are updated... Please help me

 ID    OldSalary       NewSalary
  1      2000             3000
  2      4000             5000
0

1 Answer 1

2

Here you go:

select newTable.ID, oldTable.Salary as OldSalary, newTable.Salary as NewSalary
from oldTable 
    join newTable on oldTable.ID = newTable.ID
where oldTable.Salary <> newTable.Salary;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.