[Dbix-class] selecting records with no links-to
rkimball at snapapp.com
Fri Jun 14 13:10:15 GMT 2013
On Fri, Jun 14, 2013 at 7:31 AM, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk>w=
> My brain is feeling fried and is failing to solve a simple puzzle.
> Using the standard table 'artist' which has a primary key 'artistid'.
> And the other table 'cd' that has a link to artists, via a foreign key
> 'artist'. There may be more than one CD associated with a single artistid.
> I want a resultset containing all artists which have NO associated CD.
> What's the appropriate way to select this resultset?
I think you'd want to do a left outer join where cd's primary key is null.
LEFT OUTER JOIN cd
ON artist.artistid =3D cd.artist
WHERE cd.cdid IS NULL
*Ronald J Kimball*
- www.snapapp.com | Facebook <http://www.facebook.com/snapapp> *|*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the DBIx-Class