Re: Delete orphan records

2003-06-24 Thread Greg Klaus
Nevermind... Just read an interesting comment in the MySQL online docs. http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html First user comment pointed me in the right direction. Thanks for your help though. Much appreciated! (Especially when I upgrade to 4.x) -- Greg On Tue, Jun 24, 2003 a

Re: Delete orphan records

2003-06-24 Thread Greg Klaus
Jake, Since I am running MySQL 3.23.5x, I cannot do subselects. I am able to do the following: SELECT * FROM Items_Pictures LEFT JOIN Items ON Items_Pictures.Items_ID = Items.Items_ID WHERE Items.Items_ID IS NULL; *BUT*, if I try to do a DELETE instead DELETE FROM Items_Pictures

Re: Delete orphan records

2003-06-18 Thread Jake Johnson
Hello Greg, You are much better off using a not exists clause... delete from child c where not exists ( select 1 from parent p where p.id = c.id) Regards, Jake Johnson [EMAIL PROTECTED] -- Plutoid - http://

Delete orphan records

2003-06-18 Thread Greg Klaus
I am trying to delete some orphaned records in an old database on a website that I've recently taken over. Although the website is php driven, I am doing this manually in a mysql client. Mysql 3.23.54 Tables: Items: Items_ID Pictures: Picture_ID Items_ID I want to get