I am trying to code the following condition in the WHERE
clause of SQL in BigQuery, but I am having difficulty with the syntax, specifically date math:
WHERE date_column between current_date() and current_date() - 15 days
This seems easy in MySQL, but I can't get it to work with BigQuery SQL.
Use DATE_SUB
select * from TableA where Date_Column between DATE_SUB(current_date(), INTERVAL 15 DAY) and current_date()
Remember, between
needs the oldest date first
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With