WITH in BigQuery

cshin9 picture cshin9 · May 24, 2016 · Viewed 28.9k times · Source

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;

Answer

Mikhail Berlyant picture Mikhail Berlyant · May 24, 2016

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

See also how to Enabling Standard SQL