比如我的數據庫結構,主鍵刪除值olddb
& newdb
如何在MySQL根據其它表
newdb
ID email Name
-----------------------
1 [email protected] John
2 [email protected] Peter
olddb
ID email
-------------------
1 [email protected]
2 [email protected]
3 [email protected]
4 [email protected]
現在我想比較olddb
與newdb
並刪除米olddb
的電子郵件沒有電子郵件中newdb
讓我知道
DELETE FROM olddb, newdb
USING olddb
INNER JOIN newdb USING(email)
WHERE olddb.email <> newdb.email