根据某个字段去重

select * from  tablename  as  a 
where not exists (select 1 from  tablename  where attachid=a.attachid and name<a.name) 

 mysql另一种去重方式

   select * from table group by name
原文地址:https://www.cnblogs.com/zzt-lovelinlin/p/10307495.html