答案 0 :(得分:0)
您可以为每个类别使用max_date连接
select * from
my_table m
inner join (
select category, max(date) max_date
from my_table
group by category) as t on m.date = t.max_date and m.category = t.category
答案 1 :(得分:0)
Thx scaisEdge !!
我终于明白了! 所以这是我的最终查询
select m.id, m.category, m.name, m.time
from my_table m
inner join (
select id, category, name, time
from my_table
order by id desc
) as t
on m.id = t.id
group by category