SQL string類型的資料按int類型排序,stringint

來源:互聯網
上載者:User

SQL string類型的資料按int類型排序,stringint

說明:

我在做wms進銷存軟體時,發現一個問題:一張入庫單(T_OutIn_BoxTop),入庫掃描時要分成多箱,箱號(BoxTop_No)可以是數字也可以是字串,所以箱號只能是字串類型的,問題來了,如何進行排序呢?


具體如下:

排序時:CAST(Box_No AS INT)

sql語句:

 SELECT  * FROM T_OutIn_BoxTop 

WHERE MainTop_ID =17722  ORDER BY CAST(Box_No AS INT)  ASC

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.