当我运行此查询时
SELECT PartNumber
FROM [devbivarcom].[Products].[Products]
ORDER BY PartNumber ASC
我得..
LC-4.12
LC-4.25
LC-4.5
LC-4.975
LC-40.0
LC-48.0
LC-5.0
LC-5.5
LC-5.75
有什么办法可以让它成为字母数字或识别小数?
所以就像......
LC-4.12
LC-4.25
LC-4.5
LC-4.975
LC-5.0
LC-5.5
LC-5.75
LC-40.0
LC-48.0
谢谢!
答案 0 :(得分:2)
答案 1 :(得分:0)
如果部件号按前缀分类为“类别”,请用“ - ”分隔,然后建议将部分编号拆分为“类别”和数字:
ORDER BY SUBSTRING(Partnumber, 1, charindex("-",Partnumber)-1), cast(substring(Partnumber, charindex("-",Partnumberd)+1) as float)