Created
September 30, 2020 01:34
-
-
Save dewaldabrie/231405f66c9b639a7e62a7278a00ac04 to your computer and use it in GitHub Desktop.
BigQuery Variables Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE start_time TIMESTAMP; | |
DECLARE stop_time TIMESTAMP; | |
SET start_time = TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY); | |
SET stop_time = TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 5 HOUR); | |
SELECT id | |
FROM my_dataset.my_table | |
WHERE created_at BETWEEN start_time and stop_time; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment