[Dbix-class] Problem with join

Peter Rabbitson rabbit+dbic at rabbit.us
Fri May 29 22:04:39 GMT 2009


Андрей Костенко wrote:
> Has I can write in DBIx::Class this query:
> 
> SELECT * FROM table1 LEFT JOIN table2 ON table2.table1_id=table2.id
> <http://table2.id>* AND table2.user_id=123*?
> 
> Where* user_id* is an any random number.
> 

For now you have to do this manually.

If the user_id is static (i.e. doesn't change) use:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08103/lib/DBIx/Class/Manual/Cookbook.pod#Arbitrary_SQL_through_a_custom_ResultSource

If the join condition is dynamic use the last example at:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08103/lib/DBIx/Class/ResultSet.pm#from



More information about the DBIx-Class mailing list