UNPIVOT with SQL Workbench/J and amazon aws redshift

TiiviTaavi

New Member
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:\[code\]SELECT campaign_id, C.B, C.AFROM campaignUNPIVOT ( A FOR B IN (item1, item2, item3)) AS C\[/code\]I get the following error:\[quote\] ERROR: syntax error at or near "for" Position: 62 [SQL State=42601] \[/quote\]If possible, I'd like to use UNPIVOT rather than UNION and it doesn't recognize UNNEST as a function.
 
Top