select xxxxx as a
, a * 2 as bThough, I think it might have to be table sources, then `SELECT`, then `WHERE`, then ... because you might want to refer to output columns in the `WHERE` clause.
"select" can also be replaced with annotations, something like: `from table_1 t1 let t1.column_1 as @output_1 where ...` and then just collect all the @-annotated variables.
I need to write a lot of SQL, and it's so clumsy. Every time I need a CTE, I have to look into the documentation for the exact syntax.
Isn't that what a CTE is?
Something like
FROM foo
LET a = (x + y) * z
SELECT a;
whereas CTEs are... Common Table Expressions.The logical order, in full, is:
FROM
WHERE/JOIN (you can join using WHERE clauses and do FROM a,b still)
SELECT
HAVING
Something like a ‘let’ binding after the FROM/JOIN list would make sense, though - from the query planners perspective it’s nothing more than a token substitution and everything would compile the same.
https://docs.cloud.google.com/bigquery/docs/reference/standa...
it's not something that i've found a particular use for, but it IS a thing you can do.
Exuma•2mo ago
mberning•2mo ago
sbuttgereit•2mo ago
kermatt•2mo ago
zX41ZdbW•2mo ago
petereisentraut•2mo ago