[Dbix-class] Multi-table selects?

Brandon Black blblack at gmail.com
Tue Dec 26 14:33:05 GMT 2006


On 12/26/06, Tom Lanyon <tom at netspot.com.au> wrote:
> Hi all,
>
> Am I able to do a multi table select in DBIC without using a JOIN?
>
> Example: 'SELECT t1.*, t2.* FROM t1, t2 WHERE t1.foo = t2.bar AND t1.baz
>  > 5'.
>
> If this is currently unimplemented in DBIC, what is needed to implement
> such a query?
>

That syntax is just sugar for your database (I bet you're using
postgres).  Internally, the database converts your statement to use
the appropriate joins based on the where clause.  Your example
statement is equivalent to: SELECT t1.*, t2.* FROM t1 JOIN t2 ON
(t1.foo = t2.bar) WHERE t1.baz > 5

Seeing as it is always transformable to real sql, we don't need to do
anything to support it.

-- Brandon



More information about the Dbix-class mailing list