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
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.