Welcome 微信登录

首页 / 数据库 / MySQL / MySQL查询第几行到第几行记录

1、查询第一行记录:    select   *   from   table  limit   12、查询第n行到第m行记录
     select * from table1  limit n-1,m-n;     SELECT * FROM table LIMIT 5,10;返回第6行到第15行的记录     select * from employee limit 3,1; // 返回第4行
3、查询前n行记录    select * from table1 limit 0,n;或    select * from table1 limit n;4、查询后n行记录     select * from table1 order by id desc dlimit n;//倒序排序,取前n行 id为自增形式5、查询一条记录($id)的下一条记录     select * from table1 where id>$id  order by id asc dlimit 16、查询一条记录($id)的上一条记录    select * from table1 where id<$id  order by id desc dlimit 1MySQL 测试 sql-bench 出错MySQL关联查询优化实例相关资讯      MySQL教程 
  • 30分钟带你快速入门MySQL教程  (02月03日)
  • MySQL教程:关于I/O内存方面的一些  (01月24日)
  • CentOS上开启MySQL远程访问权限  (01/29/2013 10:58:40)
  • MySQL教程:关于checkpoint机制  (01月24日)
  • MySQL::Sandbox  (04/14/2013 08:03:38)
  • 生产环境MySQL 5.5.x单机多实例配  (11/02/2012 21:02:36)
本文评论 查看全部评论 (0)
表情: 姓名: 字数