说明:stable表中name字段的值存在重复(比如有多个tom,但年龄是不一样的),即其它的值不重复,但想取其name唯一的值

select * from stable s1 where id in (select max(distinct id) from stable s2 where s1.name=s2.name ) order by id desc