[Dbix-class] Subquery question

Dan Horne dan.horne at redbone.co.nz
Tue May 16 10:39:06 CEST 2006

Hi All

I'm trying to figure out how to perform subqueries with DBIx::Class. For
example, I want to find all the roles that user 2 hasn't been assigned.
The standard SQL is

select role_id, display_name
from   app_role a
where  not exists
    (select 1
     from   user_role u
     where  u.user_id = 2
     and    u.role_id = a.role_id);

What would the DBIx::Class equivalent be?


Dan Horne

More information about the Dbix-class mailing list