In general, common table expressions are useful whenever a table expression must appear multiple times within a single query. The following typical situations are suited to common table expressions.
Queries that involve multiple aggregate functions.
Views within a procedure that must contain a reference to a program variable.
Queries that use temporary views to store a set of values.
This list is not exhaustive; you may encounter many other situations in which common table expressions are useful.
Discuss this page in DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|