我有一个表,其中包含列值
45
55
47
AB
56
AC
43
我想排序为
45
55
47
56
43
AB
AC
表示先是数字,然后是字符串,并且不按 asc 或 desc 排序
请建议我如何做
最佳答案
在SQL中,您可以简单地在order by
子句中使用patindex()
函数
order by patindex('%[a-z]%', col), ?;
但是,?
指定表数据排序的实际 col
关于sql - 首先对表中的数据进行数字排序,然后对字符串进行排序(不带 asc 或 desc),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49891823/