mysql通用的查找当前数据的上一条下一条数据

背景 应项目须要,须要在返回当前页信息时返回它的上一页和下一页信息的id,因而就有了这篇文章。 思路 经过主键id进行比较web 方法一: 上一条: select * from table_a where id = (select id from table_name where id < {$id} order by id desc limit 1); 下一条: select * from
相关文章
相关标签/搜索