如何不用一條一條刪除MySQL數(shù)據(jù)
問題描述
select查詢數(shù)據(jù)庫里面有幾萬條id數(shù)據(jù),select id from tb1 where serverindex = 2;223323424353...現(xiàn)在需要根據(jù)上面查詢到的id,把數(shù)據(jù)刪除,有什么快速的方法不用一條一條刪除delete from tb2 where id = 2233...
問題解答
回答1:delete from tb2 where id in (select id from tb1 where serverindex = 2)
這樣不就可以了。。
回答2:delete from table2 tb2 left join tabele1 tb1 on tb2.id = tab1.id where tb1.serverindex = 2回答3:
drop database
回答4:DELETE FROM TABLE2 TB2 WHERE EXISTS (SELECT 1 FROM TABELE1 TB1 ON TB2.ID = TAB1.ID WHERE TB1.SERVERINDEX = 2)回答5:
上面的答案通通錯(cuò)誤!對于你來說!你只能安裝Navicat Premium這個(gè)軟件來解決!why,因?yàn)闃巧系亩际腔A(chǔ)知識(shí)!
相關(guān)文章:
1. phpstudy8.1沒集成mysql-front2. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””3. node.js - mongodb查找子對象的名稱為某個(gè)值的對象的方法4. docker鏡像push報(bào)錯(cuò)5. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題6. javascript - 在 model里定義的 引用表模型時(shí),model為undefined。7. 運(yùn)行python程序時(shí)出現(xiàn)“應(yīng)用程序發(fā)生異常”的內(nèi)存錯(cuò)誤?8. javascript - QQ第三方登錄的問題9. 利用IPMI遠(yuǎn)程安裝centos報(bào)錯(cuò)!10. html5 - datatables 加載不出來數(shù)據(jù)。

網(wǎng)公網(wǎng)安備