table-ref
A reference to a database table with an optional alias
Format
TableName [ UNION TableName ]* [ AS Alias ]
Remarks
A union of one or more database tables with an optional alias.
This form of UNION allows data sources to be combined in the FROM clause:
SELECT ColRef FROM TableName UNION TableName
The following restrictions apply:
- Duplicates are not removed.
- Not all data sources are supported. For example, you cannot combine Data Tables in this manner.
- You cannot use this syntax with table names of historic tables or historic views. You have to include a SELECT clause when querying historic tables or historic views, to restrict the amount of data that is being queried (see Requirements when Querying Historic Tables).
Take care when adding WHERE clauses to reference fields which, when appearing in both tables, are defined separately in their class hierarchies. Such comparisons should not check for null references by comparing with -1, but should instead check for less than zero.
SELECT
FULLNAME, ID, OUTSTATIONID
FROM
CDNP3ANALOGIN UNION CDNP3BINARYIN
WHERE
( OUTSTATIONID < 0 )
ORDER BY
FULLNAME ASC
Note that the comparison in the above syntax is '< 0
' and not '= -1
'.
INTERSECT and EXCEPT operators and UNION JOIN are not supported.