[Dbix-class] Problem with join

Moritz Onken onken at houseofdesign.de
Fri May 29 16:50:45 GMT 2009


Am 29.05.2009 um 16:50 schrieb Андрей Костенко:

> Has I can write in DBIx::Class this query:
>
> SELECT * FROM table1 LEFT JOIN table2 ON table2.table1_id=table2.id  
> AND table2.user_id=123?
>
> Where user_id is an any random number.

Depends on your schema.


I'd say this is equivalent to:

> SELECT * FROM table1 LEFT JOIN table2 ON table2.table1_id=table2.id  
> WHERE table2.user_id=123


Could be

$rs->search({ 'table2.user_id' => 123}, { prefetch => 'table2' });

cheers,

moritz




More information about the DBIx-Class mailing list