我有一列名称为标题的行:
我需要这样排序
有什么办法吗?(列类型为 varchar)
笨重,但应该可以工作,前提是您的所有条目都采用 xxx 格式:
select yourColumn
from yourTable
order by
cast(substring_index(yourColumn,'.',1) as unsigned),
cast(substring_index(substring_index(yourColumn,'.',2),'.',-1) as unsigned),
cast(substring_index(substring_index(yourColumn,'.',3),'.',-1) as unsigned)
;
Run Code Online (Sandbox Code Playgroud)