Correlated attributes

You cannot reference correlated attributes that exceed the scope of a SQL-derived table from a SQL-derived-table expression. For example, the following query results in an error:

select * from publishers
   where pub_id in 
      (select pub_id from 
         (select pub_id from titles
          where pub_id = publishers.pub_id)
       dt_publishers)

Here, the column publishers.pub_id is referenced in the SQL-derived-table expression, but it is outside the scope of the SQL-derived table dt_publishers.