比较不同表中的2个Mysql列并删除

ok, so my problem is this

I have an auction website that supports autolisting, however what happens is when the auction gets autolisted it does not clean the old entries, so i was going to write some php code and run it as an cronjob to clear the entries say after 2 days or so, the tables being referenced are probid_auctions & probid_auction_media and the column is auction_id, I would like to take the column auction_id in probid_auction_media and compare it with the column auction_id in probid_auctions and delete any entries in probid_auction_media that did not match

testing this now

mysql_connect($host, $username, $password);
mysql_select_db("b1396hos_database1") or die( "Unable to select database");
$db->query("DELETE * FROM  probid_auction_media 
WHERE auction_id NOT IN (SELECT DISTINCT auction_id FROM probid_auctions");

Use query like this

DELETE
FROM probid_auction_media
WHERE auction_id NOT IN(SELECT
                      probid_auction_media.auction_id
                    FROM probid_auctions,
                      probid_auction_media
                    where probid_auctions.auction_id != probid_auction_media.auction_id);
DELETE FROM probid_auction_media 
WHERE auction_id NOT IN (SELECT DISTINCT auction_id FROM probid_auctions);

楼上的有效 ,小本子以记好 感谢

DELETE FROM rereche_item_a
WHERE car_id NOT IN (SELECT DISTINCT car_id FROM rereche_item_c);