Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Using temporary tables via WITH (named subqueries) in Google BigQuery
-- Using temporary tables via WITH (named subqueries) in Google BigQuery; 2020-05-29
-- @see http://www.pascallandau.com/bigquery-snippets/use-temporary-tables-with-named-subquery/
WITH data as (
SELECT
1 as id,
DATE("2018-04-08") AS date,
UNION ALL SELECT 2, DATE("2018-04-09")
UNION ALL SELECT 3, DATE("2018-04-10")
UNION ALL SELECT 4, DATE("2018-04-11")
),
filtered_data as (
SELECT
id
FROM
data
WHERE
id BETWEEN 2 and 3
)
SELECT
*
FROM
filtered_data
@paslandau
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment