I think I see where you're going with this. I assume you are currently
doing this:
$select = $db->select()
->from('table1')
->join('table2', 'table1.column1 = table2.column1');
And you're prefer to do this:
$select = $db->select()
->from('table1')
->joinUsing('table2', 'column1');
The two queries should produce the same result, assuming that your join
condition in the first example is an equality between two columns that
have the same name in both tables. Let's open a feature request for
this: http://framework.zend.com/issues/browse/ZF-1845
Also, you might like to use joinNatural(), which would be even more
concise. It is like USING, but automatically makes an equi-join using
all columns that have the same name in both tables. Here's how you do
it in Zend_Db_Select:
$select = $db->select()
->from('table1')
->joinNatural('table2');
Both USING and NATURAL JOIN syntax forms are ANSI SQL standard, but do
all our supported database brands support these forms?
Supports USING:
MySQL = yes; Oracle = yes; DB2 = yes; SQLite = yes; PostgreSQL = yes; MS
SQL Server = no.
Supports NATURAL JOIN:
MySQL = yes; Oracle = yes; DB2 = no; SQLite = yes; PostgreSQL = yes; MS
SQL Server = no.
Regards,
Bill Karwin
> -----Original Message-----
> From: Dan Rossi [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 13, 2007 3:08 AM
> To: Zend Framework
> Subject: [fw-general] Zend_Select and the USING join keyword
>
> When I try to create a join but in the column using a "USING"
> expression, join and joinInner generate a ON keyword. Any
> ideas around this ?
>