On 12/15/15, Karl Lehenbauer <karl at flightaware.com> wrote: > > sqlite> select fp from flightplans; > > Error: no such column: fp > > But if I select a column that doesn?t exist within an embedded subquery, it > is not an error? > > sqlite> delete from inflight where fp in (select fp from flightplans); >
The "fp" in the subquery resolves to the "inflight" table of the outer query. In other words, the subquery is acting like a correlated subquery. This is confusing, I know, but it is the Right Thing. PosgreSQL does the same. Interesting timing: I was monitoring an inbound flight on flightaware when this issue report arrived in my inbox. :-) -- D. Richard Hipp drh at sqlite.org