Skip to content
Advertisement

WITH in BigQuery

Does BigQuery support the WITH clause? I don’t like formatting too many subqueries.

For example:

WITH alias_1 AS (SELECT foo1 c FROM bar)
, alias_2 AS (SELECT foo2 c FROM bar a, alias_1 b WHERE b.c = a.c)
SELECT * FROM alias_2 a;

Advertisement

Answer

Recently introduced BigQuery Standard SQL does support WITH clause
See more about WITH clause

See also how to Enabling Standard SQL

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement