I'm trying to use unpivot on a table. I'm using Workbench/J as a client to amazon redshift. The following select statement does not work:
SELECT
campaign_id,
C.B,
C.A
FROM campaign
UNPIVOT
(
A FOR B IN (item1, item2, item3)
) AS C
I get the following error:
ERROR: syntax error at or near "for" Position: 62 [SQL State=42601]
If possible, I'd like to use UNPIVOT rather than UNION and it doesn't recognize UNNEST as a function.
unpivot
function? Not everything supports unpivot. – Taryn