BigQuery Union Error: Syntax error: Expected keyword ALL or keyword DISTINCT but got keyword SELECT at []

Error Message:

\n\n
Error: Syntax error: Expected keyword ALL or keyword DISTINCT but got keyword \nSELECT at [16:3]\n
\n\n

Solution:

\n\n
  • For Big Query, you will have to use "UNION DISTINCT" instead of UNION
  • Replace "UNION" in your query with "UNION DISTINCT"
  • Datatypes for all union columns should be the same

nVector

posted on

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds