mysql分组后,取每组第一条数据
在mysql 5.7之前(不包括5.7)select * from (select a.* from template_detail awhere a.template_id in (3, 4)order by a.id desc) tt
group by tt.template_id;但是在mysql 5.7之后(包括5.7),这样查询会发现order by 失效是因为…
2026/7/5 21:28:35