That is indeed my plan! I admittedly haven't tried a manual join perhaps as I was under the impression search related did the same thing. Though thinking about it now search_related will attempt to return the related objects thus not left joining and it it quite possibly the source of my confusion. Many thanks for your support talking though the problem. I'm quietly confident it will work tomorrow.
Many thanks Stephen On Jun 18, 2013 7:10 PM, "Robert Wohlfarth" <[email protected]> wrote: > On Tue, Jun 18, 2013 at 12:58 PM, Stephen Shorrock < > [email protected]> wrote: > >> Thanks Robert. >> >> I've attempted to extract the relevant relationship from my code, though >> when i use it i intend to group by and test for a not exists via matching a >> null row with the left join. I really need to have a left join in this >> relationship. It appears to be working for other has_many relationships but >> not under these circumstances. I wondered whether any knew of any >> conditions that might prevent it from working. >> >> Ah, well then I answered the wrong question :) > > How about this code? > $c->model('MyApp::IndexStatus')->search({'old_statuses.id' => > undef},{join=>'old_statuses'}) > > From my novice understanding of DBIx::Class, I would expect that to find > all records from MyApp::IndexStatus that do not have a corresponding row in > old_statuses. The "join" tells the SQL generator to join the tables so that > you can add conditions about old_statuses. DBIx::Class automatically does a > LEFT JOIN because the relationship is declared has_many. > > -- > Robert Wohlfarth > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ > >
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
