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

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

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

        <legend id='b5Iqz'><style id='b5Iqz'><dir id='b5Iqz'><q id='b5Iqz'></q></dir></style></legend>
      1. <tfoot id='b5Iqz'></tfoot>

          <bdo id='b5Iqz'></bdo><ul id='b5Iqz'></ul>

        MySQL 'Order By' - 正確排序字母數字

        MySQL #39;Order By#39; - sorting alphanumeric correctly(MySQL Order By - 正確排序字母數字)

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

              <tbody id='sxDai'></tbody>
            <legend id='sxDai'><style id='sxDai'><dir id='sxDai'><q id='sxDai'></q></dir></style></legend>
                1. <tfoot id='sxDai'></tfoot>
                  本文介紹了MySQL 'Order By' - 正確排序字母數字的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想按照下面顯示的順序(數字 1-12)對以下數據項進行排序:

                  <前>123456789101112

                  但是,我的查詢 - 使用 order by xxxxx asc 按第一位數字排序:

                  <前>110111223456789

                  有什么技巧可以讓它更正確地排序?

                  此外,為了充分披露,這可能是字母和數字的混合(盡管現在不是),例如:

                  <前>A1534GG46A100B100A100JE

                  等等....

                  謝謝!

                  更新:人們要求查詢

                  select * from table order by name asc

                  解決方案

                  人們使用不同的技巧來做到這一點.我在谷歌上搜索并發現了一些結果,每個結果都遵循不同的技巧.看看他們:

                  • MySQL 中的字母數字排序
                  • MySQL 中的自然排序
                  • 混合數值的排序帶有字母數字值
                  • mySQL 自然排序
                  • MySQL 中的自然排序

                  我剛剛為未來的訪問者添加了每個鏈接的代碼.

                  MySQL 中的字母數字排序

                  給定輸入

                  1A 1a 10A 9B 21C 1C 1D

                  預期輸出

                  1A 1C 1D 1a 9B 10A 21C

                  查詢

                  Bin Way====================================選擇tbl_column,BIN(tbl_column) AS binray_not_needed_column從 db_tableORDER BY binray_not_needed_column ASC , tbl_column ASC-----------------------鑄造方式====================================選擇tbl_column,CAST(tbl_column as SIGNED) AS casted_column從 db_tableORDER BY casted_column ASC , tbl_column ASC

                  MySQL 中的自然排序

                  給定輸入

                  表:sorting_test-------------------------- -------------|字母數字 VARCHAR(75) |整數 INT |-------------------------- -------------|測試1 |1 ||測試12 |2 ||測試13 |3 ||測試2 |4 ||測試3 |5 |-------------------------- -------------

                  預期產出

                   -------------------------- -------------|字母數字 VARCHAR(75) |整數 INT |-------------------------- -------------|測試1 |1 ||測試2 |4 ||測試3 |5 ||測試12 |2 ||測試13 |3 |-------------------------- -------------

                  查詢

                  SELECT 字母數字,整數FROM sort_testORDER BY LENGTH(字母數字),字母數字

                  混合數值的排序帶有字母數字值

                  給定輸入

                  2a, 12, 5b, 5a, 10, 11, 1, 4b

                  預期產出

                  1, 2a, 4b, 5a, 5b, 10, 11, 12

                  查詢

                  SELECT 版本FROM version_sortingORDER BY CAST(版本未簽名),版本;

                  希望能幫到你

                  I want to sort the following data items in the order they are presented below (numbers 1-12):

                  1
                  2
                  3
                  4
                  5
                  6
                  7
                  8
                  9
                  10
                  11
                  12

                  However, my query - using order by xxxxx asc sorts by the first digit above all else:

                  1
                  10
                  11
                  12
                  2
                  3
                  4
                  5
                  6
                  7
                  8
                  9

                  Any tricks to make it sort more properly?

                  Further, in the interest of full disclosure, this could be a mix of letters and numbers (although right now it is not), e.g.:

                  A1
                  534G
                  G46A
                  100B
                  100A
                  100JE
                  

                  etc....

                  Thanks!

                  update: people asking for query

                  select * from table order by name asc
                  

                  解決方案

                  People use different tricks to do this. I Googled and find out some results each follow different tricks. Have a look at them:

                  • Alpha Numeric Sorting in MySQL
                  • Natural Sorting in MySQL
                  • Sorting of numeric values mixed with alphanumeric values
                  • mySQL natural sort
                  • Natural Sort in MySQL

                  Edit:

                  I have just added the code of each link for future visitors.

                  Alpha Numeric Sorting in MySQL

                  Given input

                  1A 1a 10A 9B 21C 1C 1D

                  Expected output

                  1A 1C 1D 1a 9B 10A 21C

                  Query

                  Bin Way
                  ===================================
                  SELECT 
                  tbl_column, 
                  BIN(tbl_column) AS binray_not_needed_column
                  FROM db_table
                  ORDER BY binray_not_needed_column ASC , tbl_column ASC
                  
                  -----------------------
                  
                  Cast Way
                  ===================================
                  SELECT 
                  tbl_column, 
                  CAST(tbl_column as SIGNED) AS casted_column
                  FROM db_table
                  ORDER BY casted_column ASC , tbl_column ASC
                  

                  Natural Sorting in MySQL

                  Given input

                  Table: sorting_test
                   -------------------------- -------------
                  | alphanumeric VARCHAR(75) | integer INT |
                   -------------------------- -------------
                  | test1                    | 1           |
                  | test12                   | 2           |
                  | test13                   | 3           |
                  | test2                    | 4           |
                  | test3                    | 5           |
                   -------------------------- -------------
                  

                  Expected Output

                   -------------------------- -------------
                  | alphanumeric VARCHAR(75) | integer INT |
                   -------------------------- -------------
                  | test1                    | 1           |
                  | test2                    | 4           |
                  | test3                    | 5           |
                  | test12                   | 2           |
                  | test13                   | 3           |
                   -------------------------- -------------
                  

                  Query

                  SELECT alphanumeric, integer
                         FROM sorting_test
                         ORDER BY LENGTH(alphanumeric), alphanumeric  
                  

                  Sorting of numeric values mixed with alphanumeric values

                  Given input

                  2a, 12, 5b, 5a, 10, 11, 1, 4b
                  

                  Expected Output

                  1, 2a, 4b, 5a, 5b, 10, 11, 12
                  

                  Query

                  SELECT version
                  FROM version_sorting
                  ORDER BY CAST(version AS UNSIGNED), version;
                  

                  Hope this helps

                  這篇關于MySQL 'Order By' - 正確排序字母數字的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 數據幀讀取?)

                2. <tfoot id='kny1K'></tfoot>

                    1. <legend id='kny1K'><style id='kny1K'><dir id='kny1K'><q id='kny1K'></q></dir></style></legend>

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

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

                            <bdo id='kny1K'></bdo><ul id='kny1K'></ul>
                          • 主站蜘蛛池模板: 日本午夜精品一区二区三区 | 日韩av成人| 亚洲一区播放 | 欧美日韩国产精品一区 | 国产精品2 | 亚洲一区视频在线 | 视频一区二区国产 | av在线三级 | 91综合在线视频 | 国产一区二区在线免费 | 欧美日韩久久 | 久一久| 亚洲伊人久久综合 | 日韩喷潮| 欧美午夜久久 | 欧美国产日韩在线 | 成人在线中文字幕 | 69亚洲精品 | 国产精品国产 | 久久久久久网站 | 一区二区免费看 | 亚洲狠狠丁香婷婷综合久久久 | h视频在线观看免费 | 天天av综合 | 99久久免费精品 | 欧美日韩视频 | 亚洲国产成人av | 欧美美乳| 99久热| 一区不卡在线观看 | 一区二区三区在线看 | 在线观看亚洲专区 | 亚洲欧美视频 | 五月婷婷在线视频 | 成人福利网 | 欧美一区二区网站 | 亚洲成人日韩 | 国产精品不卡一区 | 婷婷色国产偷v国产偷v小说 | 污视频免费在线观看 | 日韩国产精品一区二区三区 |