I have a table with this structure:
date colname value
----------------------------
date col1name col1's value
date col2name col2's value
date col3name col3's value
Now I need to convert it into this structure:
date col1name col2name col3name
-----------------------------------------------
date col1's value col2's value col3's value
Is it possible?
You want a pivot table:
If you want to make it dynamic based on the colname value, you’ll need to use dynamic SQL because you need to get the list of colname values first before constructing the actual query.
Oracle didn’t add PIVOT/UNPIVOT support until 11g. The
CASEexpression is supported 9i+; prior to 9i you’d have to use DECODE…