登录

mysql字符串排序问题

# MySQL
阿神阿神2146 天前380 次浏览

全部回复(3) 我要回复

  • ringa_lee

    ringa_lee2017-04-17 15:46:50

    第一种:select * from qx_cate order by id desc;
    第二种:select from qx_cate where id != 16 union all select from qx_cate where id = 16;

    回复
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:46:50

    order by cast(replace(path, ',', '') as unsigned integer)

    需要注意 path 超出 int 范围的情况, 或者另寻他法

    回复
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:46:50

    因为path是按Alphabetical Sorting做的
    题主要的是Natural Sorting
    网上有相关的解决办法可以自己找一下

    回复
    0
  • 取消回复发送