zoukankan      html  css  js  c++  java
  • MySql limit offset

    【1】关于MySql limit offset 语法请参考以下测试示例SQL语句:

     1 # limit后面显示1条数据,从索引为0行开始读取
     2 SELECT *
     3 FROM cfg_acct_free_res
     4 WHERE product_id = '01086391522'
     5 ORDER BY call_type DESC
     6 LIMIT 1;
     7 # 换句话说,LIMIT n 等价于 LIMIT 0, n
     8 
     9 # limit后面显示1条数据,从索引为1行开始读取
    10 SELECT *
    11 FROM cfg_acct_free_res
    12 WHERE product_id = '01086391522'
    13 ORDER BY call_type DESC
    14 LIMIT 1, 1;
    15 
    16 # limit后面显示3条数据,从索引为1行开始读取
    17 SELECT *
    18 FROM cfg_acct_free_res
    19 WHERE product_id = '01086391522'
    20 ORDER BY call_type DESC
    21 LIMIT 1, 3;
    22 
    23 # limit后面显示3条数据,offset后面是从第1条开始读取
    24 SELECT *
    25 FROM cfg_acct_free_res
    26 WHERE product_id = '01086391522'
    27 ORDER BY call_type DESC
    28 LIMIT 3 OFFSET 1;
    29 
    30 # 换句话说,LIMIT语法与OFFSET的等价关系:从索引为1位置向后取3条记录
    31 # 1.limit 1, 3
    32 # 2.limit 3 offset 1 等价于limit 1, 3

    Good Good Study, Day Day Up.

    顺序 选择 循环 总结

  • 相关阅读:
    OpenCV数字图像处理学习笔记整理
    SSM框架整合
    Spring MVC 拦截器
    SpringMVC的JSON数据交互和RESTful支持
    Spring MVC数据绑定
    Spring MVC 入门
    Spring 与 Mybatis整合
    MyBatis的关联映射
    iview table中的render函数使用
    iview+vue查询分页实现
  • 原文地址:https://www.cnblogs.com/Braveliu/p/10108095.html
Copyright © 2011-2022 走看看