Please explain the best way to compare two rows and display the fields along with the change value.
Example
| ID | EmployeeID | EmployeeName | Address1 | Address2 | Salary | UpdatedDate |
|---|---|---|---|---|---|---|
| 1 | 501 | Johnson | 2nd Ave | 108 | 850 | 04/04/2020 |
| 2 | 501 | Johnson | 2nd Ave | 109 | 900 | 04/05/2020 |
| 3 | 501 | Johnson | 3rd Ave | 109 | 950 | 04/06/2020 |
Each row is an new version of the previous row. Based on the input value, the previous row need to be compared and difference should be highlighted.
Example: Input: 3
| Column | NewValue | OldValue |
|---|---|---|
| Address1 | 3rd Ave | 2nd Ave |
| Salary | 950 | 900 |
Input: 2
| Column | NewValue | OldValue |
|---|---|---|
| Address2 | 109 | 108 |
| Salary | 900 | 850 |
The fields names should dynamically picked while comparing and should ignore the primary key and updateddate fields alone.
Thanks