1 Reply Latest reply on Aug 28, 2018 9:39 AM by Okechukwu Ossai

    I'm getting an error when I use the 'WITH' statement.

    Antariksh Mishra

      I'm connected to Google Cloud SQL as the data source for the first time.

       

      When I'm writing a 'Custom SQL' with the folllowing code:

       

      SELECT * FROM 'Table A'

      UNION

      SELECT * FROM 'Table B'

      UNION

      SELECT * FROM 'Table C'

       

      , the code is working.

       

      But when I write the following code:

       

      WITH all AS (

      SELECT * FROM 'Table A'

      UNION

      SELECT * FROM 'Table B'

      UNION

      SELECT * FROM 'Table C')

       

       

      SELECT * FROM all

       

      , the code is not working. Its giving me an error which goes like :

       

      An error occurred while communicating with Google Cloud SQL.

       

       

      Bad Connection: Tableau could not connect to the data source.

      [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.14-google-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all AS (SELECT * FROM Table A

        UNION

        SELECT * FROM Table B

        UNION

        SE' at line 3

       

      Any solution for this? Thanks!