function SelectQuery::union

Overrides SelectQueryInterface::union

File

includes/database/select.inc, line 1451

Class

SelectQuery
Query builder for SELECT statements.

Code

public function union(SelectQueryInterface $query, $type = '') {
    // Handle UNION aliasing.
    switch ($type) {
        // Fold UNION DISTINCT to UNION for better cross database support.
        case 'DISTINCT':
        case '':
            $type = 'UNION';
            break;
        case 'ALL':
            $type = 'UNION ALL';
        default:
    }
    $this->union[] = array(
        'type' => $type,
        'query' => $query,
    );
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.