MySQL重复记录删除
一种诡异的写法:
delete t from t, ( select table_name,max(id) id from t group by table_name having count(*)>1 ) d where t.table_name=d.table_name and t.id<d.id;
没见过这种语法,记录一下。
一种诡异的写法:
delete t from t, ( select table_name,max(id) id from t group by table_name having count(*)>1 ) d where t.table_name=d.table_name and t.id<d.id;
没见过这种语法,记录一下。