/* 方式1: 获取给出id 的上一条,下一条 */
select * from t_article where id = (select id from t_article where id < 4 order by id desc limit 1);
select * from t_article where id = (select id from t_article where id > 4 order by id asc limit 1);
/* 方式2: 获取给出id 的上一条,下一条 */
本文链接:https://www.dnwfb.com/1552.html,转载请注明出处。select * from t_article where id = (select max(id) from t_article where id < 4);
select * from t_article where id = (select min(id) from t_article where id > 4);
评论0