1 select.inc public SelectQueryInterface::union(SelectQueryInterface $query, $type = '')

Add another Select query to UNION to this one.

Union queries consist of two or more queries whose results are effectively concatenated together. Queries will be UNION'ed in the order they are specified, with this object's query coming first. Duplicate columns will be discarded. All forms of UNION are supported, using the second '$type' argument.

Note: All queries UNION'ed together must have the same field structure, in the same order. It is up to the caller to ensure that they match properly. If they do not, an SQL syntax error will result.


$query: The query to UNION to this query.

$type: The type of UNION to add to the query. Defaults to plain UNION.

Return value

SelectQueryInterface: The called object.


core/includes/database/select.inc, line 451


Interface definition for a Select Query object.


public function union(SelectQueryInterface $query, $type = '');