1
$db->query("DELETE FROM   probid_auction_media 
WHERE auction_id NOT IN SELECT DISTINCT auction_id FROM probid_auctions");

这是我正在使用的代码,我想做的是将 probid_auction_media 中的auction_id 列与 probid_auctions 中的auction_id 列进行比较,并从 probid_auction_media 中删除任何不是数学的列

4

2 回答 2

0

你需要括号:

DELETE FROM   probid_auction_media 
WHERE auction_id NOT IN 
      ( SELECT auction_id FROM probid_auctions )
于 2012-04-11T23:12:21.483 回答
0

你缺少括号。此外, aDISTINCT可能不是必需的:

DELETE FROM probid_auction_media
    WHERE auction_id NOT IN (SELECT auction_id FROM probid_auction)
于 2012-04-11T23:12:48.667 回答