Understanding How to Extract Data Within a Specified Time Period: No matching signature for operator BETWEEN for argument types: TIMESTAMP, DATE, DATE

Asked 1 years ago, Updated 1 years ago, 109 views

You want to specify a specific column (timestamp type) for the data table in a big query to extract only data within any period of time.

·Satei_date is within 2 months

The query is listed as follows, but an error occurs.
I would appreciate it if you could tell me the cause and how to fix it.

Query

 WHERE sitei_date BETWEEN CURRENT_DATE() and DATE(CURRENT_DATE, INTERVAL-2 MONTH)

Error Code

No matching signature for operator BETWEEN for argument types: TIMESTAMP, DATE, DATE.Supported signature: (ANY) BETWEEN (ANY) AND (ANY)

sql google-bigquery

2022-09-30 20:22

1 Answers

Error trying to compare TIMESTAMP and DATE types.
I don't know what database you are using, but I think you should use a function that converts the value returned by CURRENT_DATE() into a TIMESTANP type.


2022-09-30 20:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.