Hi,

I've inherited a busted database and need to clean it up. I can't figure out how to do something which seemingly should be simple.

For example, I've got two tables:

Table One
id int primary key auto_increment not null
...other data

Table Two
id int primary key auto_increment not null
...other data

I'd like to delete all of the records from Table Two which have an id that is not found in Table One.

I could do it programatically in C or PHP or ... but is there some kind of SQL statement than can do the job?

Thanks,

Bill

--
Bill Rausch, Software Engineer

"UNIX for programming, Mac for productivity, Windows for solitaire..."

---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to