Interesting, I finally tried to run the entire query with that last bit, and now I get this:
ERROR: subquery in FROM must have an alias
Hint: For example, FROM (SELECT ...) [AS] foo.
Position: 1092
So I need to figure out how to generate that alias for the select....
I told you how to do that just above.
^ @dcj did you not see my suggestion?
yes, wrapping the entire thing in an outer select :*
?
No, the alias in the from
clause.
trying that now,
(from [ (some subquery) :alias ])
=> FROM (some subquery) AS alias
So it’s just a matter of how much of your query needs to go into that (some subquery)
piece.
Seem to recall issue with subsequent inner joins not being inside the enveloping FROM