(select name, points
from users
where points <= (select u2.points from users u2 where u2.name = ?)
order by points desc
limit 11
) union all
(select name, points
from users
where points > (select u2.points from users u2 where u2.name = ?)
order by points asc
limit 10
) ;
1条答案
按热度按时间jvidinwx1#
一种方法使用子查询和
union all
:返回21行,包括指定的用户。