<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 查询结果中显示序列号

        时间:2023-10-08
        • <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 查询结果中显示序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL:按块检索大选择 下一篇:如何按 MAX(日期)选择?

                  相关文章

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

                    2. <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>