Issue Type: Improvement Created: 2007-08-13T19:49:23.000+0000 Last Updated: 2008-03-21T16:25:34.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)
Reporter: Bill Karwin (bkarwin) Assignee: Simon Mundy (peptolab) Tags: - Zend_Db_Select
Related issues: Attachments:
We can currently do this:
<pre class="highlight"> $select = $db->select() ->from('table1') ->join('table2', 'table1.column1 = table2.column1');
But we'd like to do it more conveniently like this:
<pre class="highlight"> $select = $db->select() ->from('table1') ->joinUsing('table2', 'column1');
So that the resulting SQL statement uses the USING syntax.
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.
Note that USING is followed by a list of columns, comma-separated, inside parentheses.
Posted by Simon Mundy (peptolab) on 2008-01-18T21:44:13.000+0000
Bill, how had you imagined the join type being specified? If the method signature is to follow the existing patterns of joinInner, joinFull, etc... then the join type might need to be supplied as a 4th parameter which may not be optimal.
Posted by Bill Karwin (bkarwin) on 2008-01-18T23:28:03.000+0000
There should be distinct methods, to remain consistent with the current convention in Zend_Db_Select, and also to make the class friendly to code-completion tools: * joinUsing() * joinLeftUsing() * joinRightUsing() * joinFullUsing()
Likewise, the same solution could be used for NATURAL joins for consistency (though no one has asked for more support of NATURAL joins). * joinNatural() * joinLeftNatural() * joinRightNatural() * joinFullNatural()
Posted by Simon Mundy (peptolab) on 2008-02-16T19:43:35.000+0000
Resolved in trunk r8084
Have you found an issue?
See the Overview section for more details.