<tfoot id='DfJOI'></tfoot>

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

      • <bdo id='DfJOI'></bdo><ul id='DfJOI'></ul>
    1. <legend id='DfJOI'><style id='DfJOI'><dir id='DfJOI'><q id='DfJOI'></q></dir></style></legend>

        <i id='DfJOI'><tr id='DfJOI'><dt id='DfJOI'><q id='DfJOI'><span id='DfJOI'><b id='DfJOI'><form id='DfJOI'><ins id='DfJOI'></ins><ul id='DfJOI'></ul><sub id='DfJOI'></sub></form><legend id='DfJOI'></legend><bdo id='DfJOI'><pre id='DfJOI'><center id='DfJOI'></center></pre></bdo></b><th id='DfJOI'></th></span></q></dt></tr></i><div id='DfJOI'><tfoot id='DfJOI'></tfoot><dl id='DfJOI'><fieldset id='DfJOI'></fieldset></dl></div>
      1. 如何在 MySQL 查询结果中显示序列号

        How to show sequential number in MySQL query result(如何在 MySQL 查询结果中显示序列号)
        • <bdo id='Kl4da'></bdo><ul id='Kl4da'></ul>
          <tfoot id='Kl4da'></tfoot>

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

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

                  <tbody id='Kl4da'></tbody>

                • 本文介绍了如何在 MySQL 查询结果中显示序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一些简单的查询:

                  SELECT foo, bar FROM table
                  

                  我想你现在的结果是什么样的.

                  i think you now whats the result looks like.

                  我想要做的是根据查询结果中出现的数据数量来显示一些序列号.它就像 AUTO_INCREMENT(这并不意味着我想显示 ID).我想要的结果是这样的:

                  What I want to do is to show some sequential number based on how many data appear from query result. its just like AUTO_INCREMENT(its not mean i want to show ID). The result what I want is like:

                  |No|   foo   |    bar   |
                  -------------------------
                  |1 |   bla   |    123   |
                  |2 |   boo   |    abc   |
                  |3 |   wow   |    xxx   |
                  

                  我该怎么做才能做到?

                  提前致谢

                  推荐答案

                  select @rownum:=@rownum+1 No, foo, bar from table, (SELECT @rownum:=0) r;
                  

                  这篇关于如何在 MySQL 查询结果中显示序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How to update a record using sequelize for node?(如何使用节点的 sequelize 更新记录?)
                  How to provide a mysql database connection in single file in nodejs(如何在 nodejs 中的单个文件中提供 mysql 数据库连接)
                  Defining a one-to-one relationship in SQL Server(在 SQL Server 中定义一对一关系)
                  Looping Over Result Sets in MySQL(在 MySQL 中循环结果集)

                    • <bdo id='pkoGg'></bdo><ul id='pkoGg'></ul>
                        <tbody id='pkoGg'></tbody>
                    • <legend id='pkoGg'><style id='pkoGg'><dir id='pkoGg'><q id='pkoGg'></q></dir></style></legend>
                          • <small id='pkoGg'></small><noframes id='pkoGg'>

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