queryExpression (UNION|INTERSECT|EXCEPT) [ALL] queryExpression [ORDER BY...]
Set operations
You can use the SQL UNION
, UNION ALL
, INTERSECT
, and EXCEPT
set operations in Teiid to combine the results of query expressions.
Usage:
Syntax Rules:
-
The output columns will be named by the output columns of the first set operation branch.
-
Each
SELECT
must have the same number of output columns and compatible data types for each relative column. Data type conversion is performed if data types are inconsistent and implicit conversions exist. -
If
UNION
,INTERSECT
, orEXCEPT
is specified withoutall
, then the output columns must be comparable types. -
You cannot use the SQL
INTERSECT ALL
orEXCEPT ALL
operators.