public function union($select = array(), $type = self::SQL_UNION)
    {
        if (!is_array($select)) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception(
                "union() only accepts an array of Zend_Db_Select instances of sql query strings."
            );
        }

        if (!in_array($type, self::$_unionTypes)) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("Invalid union type '{$type}'");
        }

        foreach ($select as $target) {
            $this->_parts[self::UNION][] = array($target, $type);
        }

        return $this;
    }
public function union($select = array(), $type = self::SQL_UNION)
    {
        if (!is_array($select)) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception(
                "union() only accepts an array of Zend_Db_Select instances of sql query strings."
            );
        }

        if (!in_array($type, self::$_unionTypes)) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("Invalid union type '{$type}'");
        }

        foreach ($select as $target) {
            $this->_parts[self::UNION][] = array($target, $type);
        }

        return $this;
    }
public function union ( $ select = array ( ) , $ type = self :: SQL_UNION ) { if ( ! is_array ( $ select ) ) { // require_once 'Zend/Db/Select/Exception.php'; throw new Zend_Db_Select_Exception ( "union() only accepts an array of Zend_Db_Select instances of sql query strings." ) ; } if ( ! in_array ( $ type , self :: $ _unionTypes ) ) { // require_once 'Zend/Db/Select/Exception.php'; throw new Zend_Db_Select_Exception ( "Invalid union type '{$type}'" ) ; } foreach ( $ select as $ target ) { $ this -> _parts [ self :: UNION ] [ ] = array ( $ target , $ type ) ; } return $ this ; }
Adds a UNION clause to the query.

The first parameter has to be an array of Zend_Db_Select or
sql query strings.

<code>
$sql1 = $db->select();
$sql2 = "SELECT ...";
$select = $db->select()
->union(array($sql1, $sql2))
->order("id");
</code>

@param  array $select Array of select clauses for the union.
@return Zend_Db_Select This Zend_Db_Select object.
Adds a UNION clause to the query .