Wednesday, September 10, 2008

CO-RELATED SUBQUERY


A CO-RELATED SUBQUERY is one that has a correlation name as table or view designator in the FROM clause of the outer query and the same correlation name as a qualifier of a search condition in the WHERE clause of the subquery.
eg:
SELECT field1 from table1 X
WHERE field2>(select avg(field2) from table1 Y where field1=X.field1);

No comments: