I did this however, how do i get it added now to $select = $this->db- >select()

class Zend_Db_Select_Extended extends Zend_Db_Select
{
    const NATURAL_LEFT_JOIN = 'natural left join';

    /**
     * Add a NATURAL LEFT JOIN table and colums to the query.
     * A natural join assumes an equi-join across any column(s)
     * that appear with the same name in both tables.
     * Only natural inner joins are supported by this API,
     * even though SQL permits natural outer joins as well.
     *
     * The $name and $cols parameters follow the same logic
     * as described in the from() method.
     *
     * @param  array|string|Zend_Db_Expr $name The table name.
* @param array|string $cols The columns to select from the joined table.
     * @param  string $schema The database name to specify, if any.
     * @return Zend_Db_Select This Zend_Db_Select object.
     */

    public function joinLeftNatural($name, $cols = '*', $schema = null)
    {
return $this->_join(self::NATURAL_LEFT_JOIN, $name, null, $cols, $schema);
    }

}


On 06/09/2007, at 5:42 AM, Daniel Rossi wrote:

Will it ever get added , or just create a subclass ?

On 06/09/2007, at 4:49 AM, Jack Sleight wrote:

Oh, sorry, didn't notice you wanted a natural left join. No, Zend_Db_Select doesn't support it. You will have to write out the SQL manually, or extend Zend_Db_Select and add a new method (joinLeftNatural).

Daniel Rossi wrote:
Hi, I was wondering if there is support for Natural Left Join support for Zend Select ? Ive come across a problem, where ive tried to reduce the sql on join conditions, but when using natural join, i cant do a left join on one table it claims that the field is ambigous because its the same field aswell, only natural left join will work on that table.

Let me know.

--
Jack


Reply via email to