Greating!

I have 2 tables having one-to-many relation.

I want to get all data from the 1st table filtered by an attr from the 2nd
one.

So I write

$schema->resultset("First")->search({seconds.attr => {-in => [1,2,3]}},
{join => second} );

The resulting queue does not contain the DISTINCT keyword so I get much
more records in the resultset than I want.

So how can I enforce the DBIx::Class to write a query like

Select distinct me.id, me.attr1, me.attr2
from first me
left join second ON me.id=second.first_id
where second.attr not in (1,2,3)

?

Now I have written a literal SQL, but I want to solve this problem a
DBIx::Class way.

Thank you!

-- 
SY, Dmitry Belyavsky
_______________________________________________
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/dbix-class@lists.scsys.co.uk

Reply via email to