• <bdo id='DDDH9'></bdo><ul id='DDDH9'></ul>

      <small id='DDDH9'></small><noframes id='DDDH9'>

    1. <i id='DDDH9'><tr id='DDDH9'><dt id='DDDH9'><q id='DDDH9'><span id='DDDH9'><b id='DDDH9'><form id='DDDH9'><ins id='DDDH9'></ins><ul id='DDDH9'></ul><sub id='DDDH9'></sub></form><legend id='DDDH9'></legend><bdo id='DDDH9'><pre id='DDDH9'><center id='DDDH9'></center></pre></bdo></b><th id='DDDH9'></th></span></q></dt></tr></i><div id='DDDH9'><tfoot id='DDDH9'></tfoot><dl id='DDDH9'><fieldset id='DDDH9'></fieldset></dl></div>

      1. <legend id='DDDH9'><style id='DDDH9'><dir id='DDDH9'><q id='DDDH9'></q></dir></style></legend>
        <tfoot id='DDDH9'></tfoot>

        AS400/DB2 中的分页查询(SQL)

        时间:2024-05-11
            <tbody id='3CY6T'></tbody>

            <small id='3CY6T'></small><noframes id='3CY6T'>

          1. <tfoot id='3CY6T'></tfoot>
              <bdo id='3CY6T'></bdo><ul id='3CY6T'></ul>

                <i id='3CY6T'><tr id='3CY6T'><dt id='3CY6T'><q id='3CY6T'><span id='3CY6T'><b id='3CY6T'><form id='3CY6T'><ins id='3CY6T'></ins><ul id='3CY6T'></ul><sub id='3CY6T'></sub></form><legend id='3CY6T'></legend><bdo id='3CY6T'><pre id='3CY6T'><center id='3CY6T'></center></pre></bdo></b><th id='3CY6T'></th></span></q></dt></tr></i><div id='3CY6T'><tfoot id='3CY6T'></tfoot><dl id='3CY6T'><fieldset id='3CY6T'></fieldset></dl></div>
              • <legend id='3CY6T'><style id='3CY6T'><dir id='3CY6T'><q id='3CY6T'></q></dir></style></legend>

                  本文介绍了AS400/DB2 中的分页查询(SQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在努力尝试为我们的表格创建基于 web 的 php 分页其中有超过一百万行.

                  I have been working on try to create php web-based paging for our tables which have over a million rows.

                  根据我的阅读,我有 3 个选项

                  Based on what I have read, I have 3 options

                  1. 检索结果集中的所有行 - 对我来说不可能,因为它的大小
                  2. 检索 1000 行,存储在临时表中并为它并通过它翻页 - 查询太多 - 插入太多!!
                  3. 如果有人选择向前或向后翻页,则每次运行查询

                  现在我正在尝试使选项 3 起作用.我的第一页显示为"select * from accout order by acct 仅获取前 10 行"下一页"select * from account where acct>(last record) order by acct fetch仅限前10名"最后一页记录"select * from account where acct=(select max(acct) from account)"

                  Right now I am trying to get option 3 working. I have the first page showing up as "select * from accout order by acct fetch first 10 rows only" Page next "select * from account where acct>(last record) order by acct fetch first 10 only" page last record "select * from account where acct=(select max(acct) from account)"

                  问题是显示上一页,我真的很感激在这方面提供帮助.

                  The problem is showing the previous page and i really would appreciate help in this.

                  推荐答案

                  SELECT *
                    FROM (
                      SELECT 
                        *, 
                        ROW_NUMBER() OVER (ORDER BY acct) AS RowNum
                      FROM 
                        account
                    ) AS Data
                  WHERE 
                    RowNum BETWEEN 100 AND 110;
                  

                  首先,您应该去掉 SELECT *.只选择您需要的字段.

                  First, you should get rid of the SELECT *. Select only the fields you need.

                  acct 上放置一个索引,这将有助于 ROW_NUMBER() OVER (ORDER BY acct) 构造.

                  Place an index on acct, this will help the ROW_NUMBER() OVER (ORDER BY acct) construct.

                  使用 SELECT COUNT(*) FROM account 来确定您将拥有多少页.

                  Use a SELECT COUNT(*) FROM account to determine how many pages you will have.

                  另请阅读 最快/最有效的方式使用 SQL 搜索 DB2 进行分页

                  这篇关于AS400/DB2 中的分页查询(SQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使连接池在 PHP-CGI PDO iSeries Access UnixODBC 连接上工作? 下一篇:为什么我会收到“数据转换或数据映射错误.SQLCODE=-802"在一个简单的 DB2 选择语句上?

                  相关文章

                  1. <small id='HdEBi'></small><noframes id='HdEBi'>

                  2. <legend id='HdEBi'><style id='HdEBi'><dir id='HdEBi'><q id='HdEBi'></q></dir></style></legend>
                      <bdo id='HdEBi'></bdo><ul id='HdEBi'></ul>
                    <i id='HdEBi'><tr id='HdEBi'><dt id='HdEBi'><q id='HdEBi'><span id='HdEBi'><b id='HdEBi'><form id='HdEBi'><ins id='HdEBi'></ins><ul id='HdEBi'></ul><sub id='HdEBi'></sub></form><legend id='HdEBi'></legend><bdo id='HdEBi'><pre id='HdEBi'><center id='HdEBi'></center></pre></bdo></b><th id='HdEBi'></th></span></q></dt></tr></i><div id='HdEBi'><tfoot id='HdEBi'></tfoot><dl id='HdEBi'><fieldset id='HdEBi'></fieldset></dl></div>

                    1. <tfoot id='HdEBi'></tfoot>