zoukankan      html  css  js  c++  java
  • mysql如何给字母数字混合的字段排序?

     1 mysql> select * from t_SpiritInside;
     2 +------+
     3 | col  |
     4 +------+
     5 | s1   |
     6 | s2   |
     7 | s11  |
     8 | s12  |
     9 | s13  |
    10 | s21  |
    11 | s22  |
    12 | s23  |
    13 | f11  |
    14 | f1   |
    15 | f12  |
    16 | f2   |
    17 | f21  |
    18 | f22  |
    19 +------+
    20 14 rows in set (0.19 sec)
    21  
    22 mysql> select *
    23     -> from t_SpiritInside
    24     -> order by left(col,1desc, mid(col,2)+0;
    25 +------+
    26 | col  |
    27 +------+
    28 | s1   |
    29 | s2   |
    30 | s11  |
    31 | s12  |
    32 | s13  |
    33 | s21  |
    34 | s22  |
    35 | s23  |
    36 | f1   |
    37 | f2   |
    38 | f11  |
    39 | f12  |
    40 | f21  |
    41 | f22  |
    42 +------+
    43 14 rows in set (0.09 sec)
    44  
    45 mysql>
    人生得意须尽欢,莫使金樽空对月.
  • 相关阅读:
    python 面向对象(三大特性)
    python 发红包
    python 计算器
    python 模块和包
    python 异常处理
    python 序列化模块
    python 常用模块
    esriSRGeoCS3Type Constants
    esriSRGeoCS2Type Constants
    esriSRGeoCSType Constants
  • 原文地址:https://www.cnblogs.com/luojie-/p/8980137.html
Copyright © 2011-2022 走看看