1. 查找出多字段出现重复数据次数
select
aid,count(*) as count
from pics
group by aid, filename
having count(*) > 1;
2. 删除多字段出现重复数据只保留最后一条
delete a.* from pics as a
where a.id <> (
select
min(b.id)
from (
select * from pics
) as b
where a.`aid`= b.`aid` and a.filename = b.filename
);