UNION

Combine the results of two or more queries into a single result set.

Syntax:
      query_spec UNION [ALL] query_spec  [...n ] ;

Each query_spec must return the same number of columns in the same order.
The column data types must be compatible.
ALL - Include duplicate rows in the results.

Examples

USE MyDatabase ;
SELECT MyCol_INT1, MyCol_STRING2
FROM MySchema.MyTable; UNION SELECT MyCol_INTA, MyCol_STRINGB
FROM MySchema.MyOtherTable; GO

"Eventually, all things merge into one, and a river runs through it. The river was cut by the world's great flood and runs over rocks from the basement of time. On some of the rocks are timeless raindrops. Under the rocks are the words, and some of the words are theirs. I am haunted by waters" - Norman Maclean

Related commands

SELECT
EXCEPT
INTERSECT
INSERT
UPDATE
Equivalent Oracle command: UNION


 
Copyright © 1999-2024 SS64.com
Some rights reserved