mysql上一页,mysql下一页读取

作者:Liaodeity - 2015年03月10日

mysql查询下一条,上一条信息

上一页

$sql3 = "select id,title from tb_article where id = (select max(id) from tb_article where status=1 and id < {$id})";

下一页

$sql4 = "select id,title from tb_article where id = (select min(id) from tb_article where status=1 and id > {$id})";

还可以这样

select * from table_a where id = (select id from table_a where id < {$id} order by id desc limit 1);
select * from table_a where id = (select id from table_a where id > {$id} order by id asc limit 1);


本文作者: Liaodeity

本文链接: https://www.jianbaizhan.com/article/94

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!


 请勿发布不友善或者负能量的内容。审查将对发布广告等违规信息进行处罚!