Correlated subqueries
A correlated subquery is a subquery that refers to a column of a table that is not listed in its FROM clause. The column can be in the Projection clause or in the WHERE clause. To find the table to which the correlated subquery refers, search the columns until a correlation is found.
In general, correlated subqueries diminish performance. Use the table name or alias in the subquery so that there is no doubt as to which table the column is in.
taba.col1 aa,bb,null
tabb.col2 bb, null
select * from taba where col1 in (select col1 from tabb);
select * from taba where col1 in (select tabb.col1 from tabb);
Then
the error -217 column not found
would have resulted.
The important feature of a correlated subquery is that, because it depends on a value from the outer SELECT, it must be executed repeatedly, once for every value that the outer SELECT produces. An uncorrelated subquery is executed only once.