mysql 数字字母排序
有a表如下字段
id 1 a 2 b 3 c
排序后要得到
id a b c 1 2 3
也就是说字符按照字符来排序,数字按照数字来排序
看过一个解决方案
select Id from a order by (case when REGEXP_LIKE(trim(Id),'^[0-9]+$') then ascii(Id)+74 else ascii(Id) end)
结果mysql不能识别 REGEXP_LIKE
------解决方案--------------------
select 'id' as chunion select '1'union select 'a'union select '3'union select 'c'union select '2'union select 'b'order by length(ch) desc, ch+0=0 desc, ch<div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号