Index: Zend/Db/Select.php =================================================================== --- Zend/Db/Select.php (revision 31438) +++ Zend/Db/Select.php (working copy) @@ -806,8 +806,30 @@ throw new Zend_Db_Select_Exception("You can only perform a joinUsing after specifying a FROM table"); } + if (is_array($name)) { + // Must be array($correlationName => $tableName) or array($ident, ...) + foreach ($name as $_correlationName => $_tableName) { + if (is_string($_correlationName)) { + // We assume the key is the correlation name and value is the table name + $correlationName = $_correlationName; + } else { + // We assume just an array of identifiers, with no correlation name + $correlationName = $this->_uniqueCorrelation($name); + } + break; + } + } + else { + $correlationName = $this->_uniqueCorrelation($name); + } + + if (empty($correlationName)) { + require_once 'Zend/Db/Select/Exception.php'; + throw new Zend_Db_Select_Exception("You specify a valid table when using joinUsing"); + } + $join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true); - $from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true); + $from = $this->_adapter->quoteIdentifier($correlationName, true); $cond1 = $from . '.' . $cond; $cond2 = $join . '.' . $cond;