I have a table with following columns:
SeqNo, Date, Code, Val1, Val2, Val3,.. Val20
I need to get this representation (I assume I should unpivot table part from Val1 to Val20):
SeqNo, Date, Code, Val
where all Val1 ..Val20
columns go to Val
column.
And moreover I need to change Date
column values:
- For "Val1" value in "Date" shouldn't be changed.
- For "Val2" the "Date" value should be decreased by 1 day.
- For "Val3" decrease by 2 days, etc.