久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='BNfXE'></tfoot>

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

      <i id='BNfXE'><tr id='BNfXE'><dt id='BNfXE'><q id='BNfXE'><span id='BNfXE'><b id='BNfXE'><form id='BNfXE'><ins id='BNfXE'></ins><ul id='BNfXE'></ul><sub id='BNfXE'></sub></form><legend id='BNfXE'></legend><bdo id='BNfXE'><pre id='BNfXE'><center id='BNfXE'></center></pre></bdo></b><th id='BNfXE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BNfXE'><tfoot id='BNfXE'></tfoot><dl id='BNfXE'><fieldset id='BNfXE'></fieldset></dl></div>
      • <bdo id='BNfXE'></bdo><ul id='BNfXE'></ul>
      <legend id='BNfXE'><style id='BNfXE'><dir id='BNfXE'><q id='BNfXE'></q></dir></style></legend>
      1. 使用 MySQL,如何生成包含表中記錄索引的列?

        With MySQL, how can I generate a column containing the record index in a table?(使用 MySQL,如何生成包含表中記錄索引的列?)

          <legend id='xpd5m'><style id='xpd5m'><dir id='xpd5m'><q id='xpd5m'></q></dir></style></legend>
            <tbody id='xpd5m'></tbody>
          <tfoot id='xpd5m'></tfoot>

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

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

                  本文介紹了使用 MySQL,如何生成包含表中記錄索引的列?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有什么辦法可以從查詢中獲取實際的行號?

                  Is there any way I can get the actual row number from a query?

                  我希望能夠通過名為 score 的字段訂購名為 League_girl 的表;并返回用戶名和該用戶名的實際行位置.

                  I want to be able to order a table called league_girl by a field called score; and return the username and the actual row position of that username.

                  我想對用戶進行排名,這樣我就可以知道特定用戶在哪里,即.Joe 在 200 個中排名第 100,即

                  I'm wanting to rank the users so i can tell where a particular user is, ie. Joe is position 100 out of 200, i.e.

                  User Score Row
                  Joe  100    1
                  Bob  50     2
                  Bill 10     3
                  

                  我在這里看到了一些解決方案,但我已經嘗試了其中的大部分,但沒有一個真正返回行號.

                  I've seen a few solutions on here but I've tried most of them and none of them actually return the row number.

                  我已經試過了:

                  SELECT position, username, score
                  FROM (SELECT @row := @row + 1 AS position, username, score 
                         FROM league_girl GROUP BY username ORDER BY score DESC) 
                  

                  作為衍生

                  ...但它似乎沒有返回行位置.

                  ...but it doesn't seem to return the row position.

                  有什么想法嗎?

                  推薦答案

                  您可能想嘗試以下操作:

                  You may want to try the following:

                  SELECT  l.position, 
                          l.username, 
                          l.score,
                          @curRow := @curRow + 1 AS row_number
                  FROM    league_girl l
                  JOIN    (SELECT @curRow := 0) r;
                  

                  JOIN (SELECT @curRow := 0) 部分允許變量初始化,而無需單獨的 SET 命令.

                  The JOIN (SELECT @curRow := 0) part allows the variable initialization without requiring a separate SET command.

                  測試用例:

                  CREATE TABLE league_girl (position int, username varchar(10), score int);
                  INSERT INTO league_girl VALUES (1, 'a', 10);
                  INSERT INTO league_girl VALUES (2, 'b', 25);
                  INSERT INTO league_girl VALUES (3, 'c', 75);
                  INSERT INTO league_girl VALUES (4, 'd', 25);
                  INSERT INTO league_girl VALUES (5, 'e', 55);
                  INSERT INTO league_girl VALUES (6, 'f', 80);
                  INSERT INTO league_girl VALUES (7, 'g', 15);
                  

                  測試查詢:

                  SELECT  l.position, 
                          l.username, 
                          l.score,
                          @curRow := @curRow + 1 AS row_number
                  FROM    league_girl l
                  JOIN    (SELECT @curRow := 0) r
                  WHERE   l.score > 50;
                  

                  結果:

                  +----------+----------+-------+------------+
                  | position | username | score | row_number |
                  +----------+----------+-------+------------+
                  |        3 | c        |    75 |          1 |
                  |        5 | e        |    55 |          2 |
                  |        6 | f        |    80 |          3 |
                  +----------+----------+-------+------------+
                  3 rows in set (0.00 sec)
                  

                  這篇關于使用 MySQL,如何生成包含表中記錄索引的列?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    • <small id='6uxMA'></small><noframes id='6uxMA'>

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

                            <tbody id='6uxMA'></tbody>

                            主站蜘蛛池模板: 免费观看一级毛片 | 欧美一级特黄aaa大片在线观看 | 国产精品1区2区 | 国产91综合 | av网站在线播放 | 草久久 | 九九九久久国产免费 | 一级黄大片 | 午夜久久| 亚洲欧美精品 | 日韩中文字幕 | 国产精品99久久久久 | 97成人在线| 一区二区三区欧美在线观看 | 亚洲精品久久久一区二区三区 | 亚洲在线一区 | 国产精品www| 中文字幕二区 | 毛片在线看片 | 一区二区三区视频在线观看 | 日本午夜精品 | 国产欧美一区二区三区在线播放 | 综合久久av | 一区二区视频 | 亚洲欧美视频 | 国产精品99久久久久久宅男 | 国产成人免费观看 | 91婷婷韩国欧美一区二区 | 日韩国产在线 | 99精品免费在线观看 | 国产一级网站 | 久久久一区二区三区 | 网站黄色在线免费观看 | 国产精品美女久久久久aⅴ国产馆 | 久久久久久999 | 黄色毛片在线看 | 国产一级免费视频 | 精品国产视频 | 九九导航 | 在线看亚洲 | 在线视频99 |