[Dbix-class] Multi-table selects?

Tom Lanyon tom at netspot.com.au
Wed Dec 27 01:37:51 GMT 2006


Brandon Black wrote:
> 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
>

Brandon,

Fantastic; I didn't realise that the DB Just converts it to a join.

Thanks,
Tom



More information about the Dbix-class mailing list