in reply to DBIx::Class and many-to-many searching
This is basically an SQL::Abstract construct, look there for details.@with = map { $_->id } @with; @without = map { $_->id } @without; my @articles = $schema->resultset('articles')->search({}, { join => { 'articlelinks' => 'tag' }, tag.tag => { '-not_in' => \@without, '-in' => \@with } });
(Untested!)
C.
Update: Fixed code.. maybe
PS: This will return all articles with any of the tags in @with, there's a discussion going on in #dbix-class as to whether you wanted any, or all of them..
Please give an example of the SQL you'd like to produce, for further help
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: DBIx::Class and many-to-many searching (bare non-words)
by tye (Sage) on May 30, 2006 at 17:22 UTC | |
Re^2: DBIx::Class and many-to-many searching
by BrentDax (Hermit) on May 30, 2006 at 18:57 UTC |