Skip to content

Instantly share code, notes, and snippets.

@infinex
Last active March 12, 2018 16:21
Show Gist options
  • Save infinex/88de4b0659cf10b88518c91a2c37c29c to your computer and use it in GitHub Desktop.
Save infinex/88de4b0659cf10b88518c91a2c37c29c to your computer and use it in GitHub Desktop.
big query date generator
#standard sql
#https://stackoverflow.com/questions/38929121/duplicating-records-to-fill-gap-between-dates-in-google-bigquery
SELECT day
FROM UNNEST(
GENERATE_DATE_ARRAY(
DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 YEAR),MONTH)
, CURRENT_DATE(), INTERVAL 1 DAY)
) AS day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment