I have a m:n relation

picture --<>-- picture_tags --<>-- tags

my @tag_ids = qw/2 5 6/;

Return all pictures which have all tags of the input list set.

select *
from pictures p
where 3 = (
    select count(distinct t.id)
    from picture_tags pt
    inner join tags t on t.id = pt.tag_id
    where t.id in (2,5,6)
    and pt.picture_id = p.id
)

How to express this query for DBIx::Class is beyond my still evolving
DBIC skills.

david

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to