public function _joinUsing($type, $name, $cond, $cols = '*', $schema = null)
    {
        if (empty($this->_parts[self::FROM])) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("You can only perform a joinUsing after specifying a FROM table");
        }

        $join  = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
        $from  = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);

        $cond1 = $from . '.' . $cond;
        $cond2 = $join . '.' . $cond;
        $cond  = $cond1 . ' = ' . $cond2;

        return $this->_join($type, $name, $cond, $cols, $schema);
    }
public function _joinUsing($type, $name, $cond, $cols = '*', $schema = null)
    {
        if (empty($this->_parts[self::FROM])) {
            // require_once 'Zend/Db/Select/Exception.php';
            throw new Zend_Db_Select_Exception("You can only perform a joinUsing after specifying a FROM table");
        }

        $join  = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
        $from  = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);

        $cond1 = $from . '.' . $cond;
        $cond2 = $join . '.' . $cond;
        $cond  = $cond1 . ' = ' . $cond2;

        return $this->_join($type, $name, $cond, $cols, $schema);
    }
public function _joinUsing ( $ type , $ name , $ cond , $ cols = '*' , $ schema = null ) { if ( empty ( $ this -> _parts [ self :: FROM ] ) ) { // require_once 'Zend/Db/Select/Exception.php'; throw new Zend_Db_Select_Exception ( "You can only perform a joinUsing after specifying a FROM table" ) ; } $ join = $ this -> _adapter -> quoteIdentifier ( key ( $ this -> _parts [ self :: FROM ] ) , true ) ; $ from = $ this -> _adapter -> quoteIdentifier ( $ this -> _uniqueCorrelation ( $ name ) , true ) ; $ cond1 = $ from . '.' . $ cond ; $ cond2 = $ join . '.' . $ cond ; $ cond = $ cond1 . ' = ' . $ cond2 ; return $ this -> _join ( $ type , $ name , $ cond , $ cols , $ schema ) ; }
Handle JOIN... USING... syntax

This is functionality identical to the existing JOIN methods, however
the join condition can be passed as a single column name. This method
then completes the ON condition by using the same field for the FROM
table and the JOIN table.

<code>
$select = $db->select()->from('table1')
->joinUsing('table2', 'column1');

// SELECT * FROM table1 JOIN table2 ON table1.column1 = table2.column2
</code>

These joins are called by the developer simply by adding 'Using' to the
method name. E.g.
* joinUsing
* joinInnerUsing
* joinFullUsing
* joinRightUsing
* joinLeftUsing

@return Zend_Db_Select This Zend_Db_Select object.
Handle JOIN ... USING ... syntax