Home > Software design >  Google BigQuery has a syntax error: Unexpected keyword between?
Google BigQuery has a syntax error: Unexpected keyword between?

Time:07-12

I'm doing a simple query

SELECT * 
FROM `bq-julius.stackoverflow.partitioned_questions` 
WHERE BETWEEN DATE(creation_date) = "2022-07-11" AND DATE(creation_date) = "2021-01-01"

Why am I getting "unexpected between keyword" error?

CodePudding user response:

as per https://blog.coupler.io/bigquery-between/#BigQuery_Between_Syntax, the syntax is like:

SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2

so you may want to try this, where <date_column> is your real column name for the datetime:

Blockquote SELECT * FROM bq-julius.stackoverflow.partitioned_questions WHERE <date_column> BETWEEN '2022-07-11' AND '2021-01-01'

  • Related