picoSQL - Language reference manual


UNION



Syntax:

select-without-order-by UNION [ALL] select- without-order-by

[ UNION [ALL] select- without-order-by] ...

[ORDER BY integer [ASC | DESC ][, integer [ASC | DESC ]] ...]


Purpose:

To combine the results of two or more select statements.


See alse:

SELECT


Description:


The results of several SELECT commands can be combined into a larger result using UNION. The component SELECT commands must each have the same number of items of the same type in the select list and cannot contain an ORDER BY clause. UNION statement eliminates duplicate rows: the ALL clause retains duplicate rows. The ORDER BY clause is analogous to that one used in the SELECT statement but allows to specify only integer numbers that specify the position of the columns to be sorted.

Index Previous Next