我有表tbl
:
name state
x a
x d
x c
y b
y a
现在我从查询中得到这个:
x a
x c
x d
y a
y b
但我只需要支持这个:
x d
y b
最佳答案
这是一个简单的group by
和max
select name,
max(state) state
from tbl
group by name;
关于mysql查询后端排序结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42604864/