On Mon, Sep 24, 2007 at 09:04:51AM +1000, brett gardner wrote:
> Well
>
> Is there anyway to do the following.
>
> I have a Respondent record, which has a one to many relationship with
> Answer records.
>
> I want to be able to get a set of Respondents who answered a particular
> way and I first tried do it like
>
> my $rs = $schema->resultset('Respondent')->search(
> {
> 'answers.question_id'=>$foo,
> 'answers.answer'=>$bar
> },
> {
> join=>'answers',
> }
> );
>
>
> Which works, but when you call search on this resultset again, ie,
> searching withing that subset, it fails eg
>
> $rs = $rs->search(
> {
'answers_2.question_id'=>$foo_1,
'answers_2.answer'=>$bar_1,
> },{
join=> [ 'answers', 'answers' ],
> }
> );
See the resultset docs for more info about how DBIC handles multiple aliases.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
_______________________________________________
List: http://lists.rawmode.org/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]