At 16:14 09/03/2016, you wrote: >On 3/9/2016 9:58 AM, R Smith wrote: >>On 2016/03/09 4:35 PM, Igor Tandetnik wrote: >>>Yes, but why is that a problem? It is perfectly legal, and often >>>useful, for a subquery to refer to columns from enclosing query. >>>That's what makes it a *correlated* subquery. >> >>True, but the OP's result is still in error. > >Yes, I realize that. I was only arguing against the proposition that >the query is syntactically invalid and should have been rejected on >these grounds. >-- >Igor Tandetnik
Sorry guys, I don't know why I wrote that. In fact I know: I shouldn't be talking over the phone while reading the list. Of course I use correlated subqueries a lot, but never had to re-select a column from the enclosing query. Indeed, I'd say that most of the time one uses columns from enclosing query as expressions, e.g. in comparison operators or functions in a where clause. The OP query is pretty uncommon since it's guaranteed to produce an empty result, hence it's no surprise that the bug was so old.