1. 程式人生 > >醉了,mysql的刪除居然變得這麼麻煩 delete from table where id in()

醉了,mysql的刪除居然變得這麼麻煩 delete from table where id in()

居然要加這麼多層,還需要在裡面加一個別名才可以。

刪除標題重複的舊記錄。

delete from theTable where id in
(
	select id from 
	(
		select min(id) id from theTable group by title HAVING count(*)>1
	) ids
) ;