当数据库id有断层的情况下做上一篇和下一篇时的处理方式SQL语句。
2015-12-24 15:51
423 查看
select * from 表名 wher id=(select id from 表名 where id <? order by id desc limit 1);上一篇
select * from 表名 wher id=(select id from 表名 where id >? order by id asc limit 1);上一篇
select * from 表名 wher id=(select id from 表名 where id >? order by id asc limit 1);上一篇
相关文章推荐
- 关于sqoop与datax。 和sqoop to oracle插件OraOop
- mysql 按照某个字段括号里的字符串排序
- PHP7:Mongodb API使用
- Memcached的安装和使用
- Oracle directory查询
- thinkphp的redis主从分布式的单例模式
- MySQL中文全文检索
- 二维码和相片在SQLite中的图片保存和查询
- 完整的创建数据库及实例,数据泵的导入、导出 impdp expdp
- MFC 数据库查找
- mysql 主从的配置方式
- oracle树操作(select start with connect by prior)
- 快速解决mysql Lost connection to MySQL server at 'reading initial communication packet及can't connect to mysql server on 'localhost'
- ORACLE存储过程中%TYPE和%ROWTYPE的区别
- SQL Server查询所有存储过程信息、触发器、索引
- MySQL 日期函数详解(一)
- Oracle杀死死锁进程
- oracle 10g升级到11g
- sql通过某个字段名找到数据库中对应的表
- 把数组格式数据转换成字符串存入数据库