PostgreSQL ORDER BY issue - natural sort

前端 未结 7 1314
日久生厌
日久生厌 2020-12-01 16:38

I\'ve got a Postgres ORDER BY issue with the following table:

em_code  name
EM001    AAA
EM999    BBB
EM1000   CCC

To insert a

7条回答
  •  臣服心动
    2020-12-01 16:57

    you can use just this line "ORDER BY length(substring(em_code FROM '[0-9]+')), em_code"

提交回复
热议问题