douyonglang4845 2012-04-29 04:12
浏览 46
已采纳

如果表中的行数小于限制,则返回行数 - 1

I have a table with 53 rows. My sql statement looks like this:

SELECT * FROM table LIMIT 1 , 100

It is showing me 52 rows instead of 53. What gives? Of course when I run:

SELECT * FROM table

It returns 53 rows as it should.

What is the best way to fix this, so that I can have a limit if I need it?

  • 写回答

1条回答 默认 最新

  • douxian7808 2012-04-29 04:15
    关注

    When you use LIMIT x, y, the first value is an offset. So LIMIT 1, 100 means to skip the first 1 record, and show rows 2 through 101. To get the first 100 rows without skipping any, write LIMIT 0, 100 or simply LIMIT 100.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用