select max(id),pid,fid,cname,state,redate,tname
from table group by pid,fid,cname,state,redate,tname
如果只需要PID相同的去掉一项,可改为 select * from table where id in (select max(id) as id group by pid
)
本文转自linzheng 51CTO博客,原文链接:http://blog.51cto.com/linzheng/1081543