Skip to content

Instantly share code, notes, and snippets.

@dewaldabrie
Created September 30, 2020 01:34
Show Gist options
  • Save dewaldabrie/231405f66c9b639a7e62a7278a00ac04 to your computer and use it in GitHub Desktop.
Save dewaldabrie/231405f66c9b639a7e62a7278a00ac04 to your computer and use it in GitHub Desktop.
BigQuery Variables Example
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