|
用Split函数分离订单号字符串。先建一个模块,加入下面自定义函数:Public Function split1(strIn As String, strDe As String) As String
split1 = Split(strIn, strDe)(0)
End Function
Public Function split2(strIn As String, strDe As String) As String
split2 = Split(strIn, strDe)(1)
End Function
Public Function split3(strIn As String, strDe As String) As String
split3 = Split(strIn, strDe)(2)
End Function
Public Function split4(strIn As String, strDe As String) As String
split4 = Split(strIn, strDe)(3)
End Function
Public Function MySplit(strIn As String, strDe As String) As Variant
MySplit = Split(strIn, strDe)
End Function
建一个查询,用自定义函数对订单号进行分解为几列,再根据要求进行排序,如:SELECT 表2.a, split1([a],"/") AS 表达式1, split2([a],"/") AS 表达式2, split3([a],"/") AS 表达式3, split4([a],"/") AS 表达式4
FROM 表2
ORDER BY split2([a],"/"), split3([a],"/"), split4([a],"/"); |
|