写快了 sql语句 第二行改一下
group by name
抱歉
select * from (select * from table1 order by id desc) t
group by a
order by id DESC limit 1 也能实现类似的结果,但很可能不是你要的答案,建议你说出自己的本意。
SELECT * FROM (SELECT * FROM table1 ORDER BY id DESC) AS a GROUP BY name
SELECT * FROM (SELECT * FROM table1 ORDER BY id DESC) AS a GROUP BY name 我这里的a是sql的临时变量,不是你的name.
2楼的写法是我要的 谢谢大家。