56,940
社区成员




create table t(id int auto_increment primary key, name varchar(10), v int);
INSERT t(name,v) values
('a', 1),
('a', null),
('a', 2),
('b', 3),
('b', 1),
('b', null);
-- 每个 name v值最大的那条记录
select * from t a
where id=(select id from t b where a.name=b.name order by b.v desc limit 1);
drop table t;