[Dbix-class] Left join with an extra condition

Peter Rabbitson rabbit+dbic at rabbit.us
Sat Oct 24 12:59:49 GMT 2009


On Fri, Oct 23, 2009 at 12:45:01PM -0700, Bill Moseley wrote:
> Looking for how to add an addition condition on a join.  Here's an example
> of the query with the extra condition in CAPS
> 
> select u.* <http://p.id/>, count(o.id)
> from user u
> left outer join job j on   j.user = u.id AND J.JOB_TYPE = 6
> where u.location  = ?
> group by u.*
> 

You can not do this natively yet. Your only option is a virtual view
resultset as described here:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSource/View.pm



More information about the DBIx-Class mailing list