確立在某些otherquestions這裏,在MySQL中使用「子查詢」刪除的原因是要慢一些,而相同的「選擇」查詢執行速度快: MariaDB [as_01_import]> explain select * from invoice_payment where invoice_id in (select id from dochead where system_id = 5786);
+---
我想刪除除id在所有列相同的值的所有行,除了與最低id行。 鑑於這種數據: id year file name language download
1 2014 a x h d
2 2014 a c i d
3 2014 a x h d
4 2014 a x h d
5 2015 b y j d
6 2015 b y j d
7 2015 b y j d
工作我已被接合並且左以下查詢加入: select aad.id
from [table1] aad
left outer join [table2] itm
on aad.table2_id = itm.id
left outer join [table3] eac
on aad.id = eac.table