以下语句的前提是ID为主键(不重复)的情况下
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
)
以下语句的前提是ID为主键(不重复)的情况下
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
)