SQL: 获取第 "under" 行选择的行

SQL: get rows "under" chosen row

我有一个table这样的

id name
1 qwe
2 asd
3 sdf
4 xcv
5 try

我需要 select 所选名称“下”的所有行(即名称 = 'asd'),然后按 'id' 排序并限制为 2,所以我'寻求这样的结果:

id name
3 sdf
4 xcv

我尝试 select 它作为 SELECT * FROM TableName WHERE name < 'asd' ORDER BY id DESC LIMIT 2

但是,“name < 'asd'”仅表示名称-值小于 'asd' 的行,所以我什么也得不到,因为没有小于 'asd' 的值。就我而言,我需要 select 所有行“在” 'asd' 名称下。

像下面这样尝试

select id,name from table_name
where id > ( select id from table_name where name='asd')
order by id
limit 2

demo link

SELECT *
FROM TableName
WHERE id > (SELECT id FROM TableName WHERE name = 'asd')
ORDER BY id DESC
LIMIT 2;