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

Error Message:

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

Solution:

  • 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 28 Sep 18

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