Cake\Database\Query::union PHP Метод

union() публичный Метод

By default, the UNION operator will remove duplicate rows, if you wish to include every row for all queries, use unionAll(). ### Examples $union = (new Query($conn))->select(['id', 'title'])->from(['a' => 'articles']); $query->select(['id', 'name'])->from(['d' => 'things'])->union($union); Will produce: SELECT id, name FROM things d UNION SELECT id, title FROM articles a
public union ( string | Query $query, boolean $overwrite = false )
$query string | Query full SQL query to be used in UNION operator
$overwrite boolean whether to reset the list of queries to be operated or not
    public function union($query, $overwrite = false)
    {
        if ($overwrite) {
            $this->_parts['union'] = [];
        }
        $this->_parts['union'][] = ['all' => false, 'query' => $query];
        $this->_dirty();
        return $this;
    }