21,893
社区成员
发帖
与我相关
我的任务
分享
select * from test t
where 2>(select count(*) from test where num>t.num and name=t.name);
name add num
a wefsv 3
b wers 9
b w1rs 10
as wers 12
as w3rs 13
所以问题一的又一写法是
select * from test t
where 1>(select count(*) from test1 where num>t.num and name=t.name)
select * from (select * from test order by num desc) t group by name
name add num
a wefsv 3
as w3rs 13
b w1rs 10
select * from (select * from test order by num desc) t group by name
name add num
a wefsv 3
as w3rs 13
b w1rs 10