Good morning Sunny,
From: sunny <[EMAIL PROTECTED]> > ...substituting SELECT with DELETE doesn't work :( That's right, that's how MySQL works. And it doesn't support sub-queries for this case, either. So you can't say: delete from table where field in (select field from other_table) I'd suggest doing this from another language, like Perl. For instance: $list_list = $dbh->selectall_arrayref(qq{ SELECT messages.topicid FROM messages LEFT OUTER JOIN main ON messages.topicid=main.topicid WHERE main.topicid is null }); for my $row ( @{$list_list} ) { $dbh->do(qq{DELETE FROM messages WHERE topicid = $row->[0]}); } Note, my example is rough, and not tuned for performance. But you get the idea. Hollar if you still need a hand with this. --- Rodney Broom Programmer: Desert.Net --------------------------------------------------------------------- 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