[Dbix-class] Removing orphan records from linked tables
Len Jaffe
lenjaffe at jaffesystems.com
Wed Sep 12 17:27:46 GMT 2012
On Wed, Sep 12, 2012 at 12:56 PM, Nick Prater <nick at npbroadcast.com> wrote:
> Thanks for the response. I appreciate it.
Very welcome.
>> DELETE events.*
> > Shouldn't that just be 'DELETE FROM events' ?
>
> Perhaps this is mysql specific syntax? The `events.*` is required to
> specify which table we are deleting from,
You're correct. although the '.*' part is optional.
The docs do also say however:
Currently, you cannot delete from a table and select from the same
table in a subquery.
So you're going to have to perform the left join and return a array of
event IDs, and then issue some number of
delete from event where event_id in ( ... )
> My use of 'orphan' is misleading. 'Childless' would be better.
>
Yeah. orphan means parentless.
The good news is that your on the right track. The bad news is MySQL
doesn't implement exactly what you want.
Len.
-- =
lenjaffe at jaffesystems.com 614-404-4214 www.volunteerable.net
Proprietor: http://www.theycomewithcheese.com/ - An Homage to Fromage
Greenbar <http://www.greenbartraining.org/>: Grubmaster: 2012-2009, Grub
Asst: 2008, Trained: 2007.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120912/d70=
5ee27/attachment.htm
More information about the DBIx-Class
mailing list