1 Reply Latest reply on Apr 27, 2018 4:22 AM by Chris McClellan

    Custom SQL Pivot

    kieren.aris

      Hello,

       

      I am trying to pivot from a PostgreSQL connection using the below custom SQL, but I'm getting 'an error occurred while communcating with data source 'ShowData': 'ERROR: syntax error at or near "["; Error while executing the query.

       

      I can't see what is wrong with the below, can anyone advise?

       

      SELECT

          [Date]

          , [Primary Key]

          , [Page Name]

          , [Page Id]

          , [N Fans]

          , "Age/Gender" AS [Measure Name]

          , [F_13_17] AS [Measure Value]

      FROM [table name]

       

      UNION ALL

       

      SELECT

          [Date]

          , [Primary Key]

          , [Page Name]

          , [Page Id]

          , [N Fans]

          , "Age/Gender" AS [Measure Name]

          , [F_18_24] AS [Measure Value]

      FROM [table name]