1
votes

I'm trying to use BigQuery's WITH clause as described in the documentation. I'm getting an error when running the following query:

WITH subQ1 AS (SELECT "1"),
     subQ2 AS (SELECT "2")
SELECT * FROM subQ1
UNION ALL
SELECT * FROM subQ2;

The thrown error is:

Error: Encountered " "WITH" "WITH "" at line 1, column 1. Was expecting: <EOF>

Anyone has any idea of what I'm doing wrong?

1

1 Answers

2
votes

You should do Enabling Standard SQL
Rather than this - you should be good!

BigQuery Legacy SQL does not support WITH