Hello everyone !
I am looking for a way to dynamically specify pivot columns in a SQL query, so it can be used in a view. However we don't want to hard code the values that need to become columns, and would rather extract it from another table.
I've seen other posts on internet asking the same question but without any luck 😕
Here's what we have currently :
SELECT * FROM table PIVOT (sum(my_value)
FOR mapping in ('col1', 'col2', ...)
Instead we want to use a table table_mapping containing all the values that should go in the list, is there any way to do that in sql ?
Thank you !