I have SQL issue, I can’t solve, it is not typical pivoting problem… at least for me
My source table looks like below (I simplyfied it):
I would like to pivot it by metrics column with coresponding values, final shape would be:
As you can see values from metrics column are now columns and values column was used to fill coresponding metrics.
I was trying to pivot it but this function needs aggregation function from me -> I get single record as result. Also I was trying to use row_number() function to partition it by:
- table_name
- extraction_date
- metrics
columns to use this information somehow