Hi,
When doing more complicated stuff I often use temporary tables for performance: https://cloud.google.com/bigquery/docs/reference/standard-sql/scripting-concepts#temporary_tables
It works similarly to CTEs, but instead of with results as (..., I write create temp table results as ...
The problem is when referencing SQL question made with temporary tables in another question: create temp table is put somewhere in the middle, but it needs to be on top of the new query, before select statements.
Is it possible to recognize create temp table somehow and always put them on top of the nested queries?
on the first post