我有一个类似的表
id | 名称 |
---|---|
1 | qwe |
2 | asd |
3 | sdf |
4 | xcv |
5 | 尝试 |
尝试下面的
select id,name from table_name
where id > ( select id from table_name where name='asd')
order by id
limit 2
演示链接
SELECT *
FROM TableName
WHERE id > (SELECT id FROM TableName WHERE name = 'asd')
ORDER BY id DESC
LIMIT 2;