src/Leevel/Database/Condition.php
public function union($selects, string $type = 'UNION'): self
    {
        if ($this->checkFlowControl()) {
            return $this;
        }

        if (!isset(static::$unionTypes[$type])) {
            throw new InvalidArgumentException(
                sprintf('Invalid UNION type `%s`.', $type)
            );
        }

        if (!is_array($selects)) {
            $selects = [
                $selects,
            ];
        }

        foreach ($selects as $tmp) {
            $this->options['union'][] = [
                $tmp,
                $type,
            ];
        }

        return $this;
    }
public function union($selects, string $type = 'UNION'): self
    {
        if ($this->checkFlowControl()) {
            return $this;
        }

        if (!isset(static::$unionTypes[$type])) {
            throw new InvalidArgumentException(
                sprintf('Invalid UNION type `%s`.', $type)
            );
        }

        if (!is_array($selects)) {
            $selects = [
                $selects,
            ];
        }

        foreach ($selects as $tmp) {
            $this->options['union'][] = [
                $tmp,
                $type,
            ];
        }

        return $this;
    }
添加一个 UNION 查询.

@param array|callable|string $selects
@param string                $type

@return $this