Bigquery 中 Where 子句的语法错误
Syntax error for Where clause in Bigquery
I am getting an error when I try to use where clause in the following query :
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN 2021-08-01 AND 2021-08-31;
Syntax error : No matching signature for operator BETWEEN for argument types: TIMESTAMP, INT64, INT64. Supported signature: (ANY) BETWEEN (ANY) AND (ANY) at [6:17]
What is the correct way to do it? I am trying to create daily aggregate table for month of August combing data from 2 tables.
只需查看您正在处理的实际数据类型:以下将起作用:creation_date 是时间戳数据类型,因此转换为 DATE 并对静态日期使用引号。
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
DATE(creation_date) BETWEEN '2013-01-02' AND '2021-08-31';
我会试试这个
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN '2021-08-01' AND '2021-08-31';
或这个
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN #2021-08-01# AND #2021-08-31#;
I am getting an error when I try to use where clause in the following query :
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN 2021-08-01 AND 2021-08-31;
Syntax error : No matching signature for operator BETWEEN for argument types: TIMESTAMP, INT64, INT64. Supported signature: (ANY) BETWEEN (ANY) AND (ANY) at [6:17]
What is the correct way to do it? I am trying to create daily aggregate table for month of August combing data from 2 tables.
只需查看您正在处理的实际数据类型:以下将起作用:creation_date 是时间戳数据类型,因此转换为 DATE 并对静态日期使用引号。
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
DATE(creation_date) BETWEEN '2013-01-02' AND '2021-08-31';
我会试试这个
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN '2021-08-01' AND '2021-08-31';
或这个
SELECT
creation_date
FROM
`bigquery-public-data.Whosebug.Whosebug_posts`
WHERE
creation_date BETWEEN #2021-08-01# AND #2021-08-31#;