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

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

                    • <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>