Comment by cyberax
3 months ago
Ideally, it needs to be "from", then arbitrary number of something like `let` statements that can introduce new variables, maybe interspersed with where-s, and then finally "select".
"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.
> Ideally, it needs to be "from", then arbitrary number of something like `let` statements
Isn't that what a CTE is?
Not quite. u/cyberax wants scalar bindings, not table-valued bindings.
Something like
whereas CTEs are... Common Table Expressions.
That was kind of my first thought...