I have a query that I want to transform into a new table of sorts, that will allow me to select the data along with other data. Below is the query I'm
select t.variable,t.value from data ec
cross join lateral json_to_recordset(calculation_data->0->'result'->'variables')
as t("variable" text, "value" text)
The result of the query looks like this.
variable | value
my_var | 10
my_other_var | 20
My goal here is to get a table that looks like this.
my_var | my_other_var
10 | 20
I did some research into crosstab() but that doesn't seem to do what I want. Anyone know what I could use to accomplish this?
Any help will be appreciated.