Prior to DB2 V4.1, the FROM clause of a SELECT statement could reference only table names and view names.
Now, the FROM clause can reference a subselect statement. The subselect, enclosed in parentheses, is called a nested table expression. A correlation name (a name for the table resulting from the nested table expression) must be specified when a nested table expression is used.
Nested table expressions are useful, or necessary, in these cases:
Example:
Result:
©Copyright 1996 Chuck Anesi all rights reserved