【问题标题】:Convert an Oracle pagination query into MySQL [duplicate]将 Oracle 分页查询转换为 MySQL [重复]
【发布时间】:2013-09-29 05:42:13
【问题描述】:

如何将此分页查询转换为与 MySQL 兼容:

'SELECT *
      FROM ( select p.*, ROWNUM rnum
      FROM ( select * from employees ) p
      WHERE ROWNUM <= '.(($current_page)*$perpage).' ) where ROWNUM  > '.(($current_page -1)*$perpage)';

此查询在 PHP 脚本中使用并且可以正常工作。

【问题讨论】:

  • 但是为什么投反对票..这是不公平的
  • 我没有投反对票,但工具提示说“这个问题没有显示任何研究工作......”。 Stack Overflow 上有超过 1,000 个问题已经涉及 MySQL 中的分页问题......我猜人们正在投票,因为你没有看过其中任何一个。

标签: php mysql oracle pagination


【解决方案1】:

你正在寻找 mysql 中的 Limit

 limit ($current_page -1)*$perpage , ($current_page)*$perpage

【讨论】:

  • 你能写出完整的查询吗
猜你喜欢
  • 2019-07-29
  • 2018-11-01
  • 2013-07-10
  • 2013-09-06
  • 2015-10-03
  • 1970-01-01
  • 2018-12-05
  • 2012-02-06
  • 2012-06-08
相关资源
最近更新 更多