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

        <tfoot id='4Eu8l'></tfoot>

          <bdo id='4Eu8l'></bdo><ul id='4Eu8l'></ul>

        <small id='4Eu8l'></small><noframes id='4Eu8l'>

        如何从sqlite3中获取所选结果的行数?

        时间:2023-10-10
          <tbody id='6ANLS'></tbody>
            <tfoot id='6ANLS'></tfoot>
              <bdo id='6ANLS'></bdo><ul id='6ANLS'></ul>
            • <small id='6ANLS'></small><noframes id='6ANLS'>

                  <i id='6ANLS'><tr id='6ANLS'><dt id='6ANLS'><q id='6ANLS'><span id='6ANLS'><b id='6ANLS'><form id='6ANLS'><ins id='6ANLS'></ins><ul id='6ANLS'></ul><sub id='6ANLS'></sub></form><legend id='6ANLS'></legend><bdo id='6ANLS'><pre id='6ANLS'><center id='6ANLS'></center></pre></bdo></b><th id='6ANLS'></th></span></q></dt></tr></i><div id='6ANLS'><tfoot id='6ANLS'></tfoot><dl id='6ANLS'><fieldset id='6ANLS'></fieldset></dl></div>
                  <legend id='6ANLS'><style id='6ANLS'><dir id='6ANLS'><q id='6ANLS'></q></dir></style></legend>
                  本文介绍了如何从sqlite3中获取所选结果的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想获取所选行的数量以及所选数据.目前我不得不使用两条sql语句:

                  I want to get the number of selected rows as well as the selected data. At the present I have to use two sql statements:

                  一个是

                  select * from XXX where XXX;
                  

                  另一个是

                  select count(*) from XXX where XXX; 
                  

                  可以用单个sql字符串实现吗?

                  Can it be realised with a single sql string?

                  查看了sqlite3的源码,发现了sqlite3_changes()的函数.但该函数仅在数据库发生更改时(在insert、delete 或update 之后)有用.

                  I've checked the source code of sqlite3, and I found the function of sqlite3_changes(). But the function is only useful when the database is changed (after insert, delete or update).

                  谁能帮我解决这个问题?非常感谢!

                  Can anyone help me with this problem? Thank you very much!

                  推荐答案

                  试试这个方法

                  select (select count() from XXX) as count, * 
                  from XXX;
                  

                  这篇关于如何从sqlite3中获取所选结果的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Python:如何将字典插入到 sqlite 数据库中? 下一篇:SQL - 插入一行并返回主键

                  相关文章

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

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