I have input table as below-
id | col1 | col2 | time |
---|---|---|---|
01 | abc | 001 | 12:00 |
01 | def | 002 | 12:10 |
Required output table-
id | col1 | col2 | time | diff_field |
---|---|---|---|---|
01 | abc | 001 | 12:00 | null |
01 | def | 002 | 12:10 | col1,col2 |
I need to compare both the rows and find all the columns for which there is difference in value and keep those column names in a new column diff_field.
I need a optimized solution for this as my table has more than 100 columns(all the columns need to be compared)