colpivot icon indicating copy to clipboard operation
colpivot copied to clipboard

Returning the select statement or temp table vs. void

Open adventurini opened this issue 3 years ago • 1 comments

I am trying to use this package, but I am running into complications.

Mainly, the colpivot function returns multiple results. Is there a way to isolate the results that are returned?

i.e if I do this...

select colpivot(params) ---> returns temp_table
select * from temp_table
END TRANSACTION

It will return multiple results --- one for colpivot and one for the temp_table.

If I try this...

with cte as (SELECT colpivot(params), * from some_table 
LEFT JOIN some_table on temp_table)
END TRANSACTION

It will not allow the left join because the table does not exist before the query begins.

The only thing I can think is to modify what is being returned from the function. However, I have no idea the return type because the columns are dynamic.

adventurini avatar Apr 21 '21 19:04 adventurini

@adventurini Have you found any solution to this?

zabbix-byte avatar Apr 17 '23 21:04 zabbix-byte