select p.attribute1_,p.attribute2_,p.* from app_pay_payment p order by p.attribute1_,regexp_substr(p.attribute2_,'[^0-9]+'),to_number(regexp_substr(p.attribute2_,'[0-9]+'))
上面方法可能有些复杂 ,也可以直接用下面方法
HQL写法:cast(对象属性 as long)
SQL写法:cast(字段名 as number)
本文介绍了一种使用SQL进行复杂排序的方法,包括如何利用正则表达式和数字转换来实现多条件排序。此外,还提供了HQL和SQL中进行类型转换的实用语法。
select p.attribute1_,p.attribute2_,p.* from app_pay_payment p order by p.attribute1_,regexp_substr(p.attribute2_,'[^0-9]+'),to_number(regexp_substr(p.attribute2_,'[0-9]+'))
上面方法可能有些复杂 ,也可以直接用下面方法
HQL写法:cast(对象属性 as long)
SQL写法:cast(字段名 as number)
5335
2693

被折叠的 条评论
为什么被折叠?