Skip to content
Advertisement

Postgres Get column name and value as rows for given ID

I have a table like this

I need to get values for a given ID like this

is There any simple way to achieve this.

Advertisement

Answer

You could convert the row to a json & then use json_each to transpose the data as you desire:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement