Hi,
My original table is like the following.
Question1:
Is it possible to sort the values in the columns COL1 to COL4 with the column names remain unchanged.
Also, the value that is associated with the respective column needs to re-arranged as well.
For example, B is initially COL3, and the associated value in VAL3 is 400.
B will be in COL2, so 400 should be in VAL2 as well.
The desired output is as follows:
Question2:
Within the same key, compare the values in col1-col4 with that of the previous row.
If the current row doesn't have values from previous row, create additional columns prev_col: that record those values. Similarly for the val: columns.
If the current row has new value not found from previous row, create additional columns new_col: that record those values. Similarly for the val: columns.
The desired output is as follows:
Thanks.
... View more