search

Home  >  Q&A  >  body text

mysql字符串排序问题

阿神阿神2822 days ago588

reply all(3)I'll reply

  • 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;

    reply
    0
  • 巴扎黑

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

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

    You need to pay attention to the situation when path exceeds the range of int, or find another way

    reply
    0
  • 巴扎黑

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

    Because the path is based on Alphabetical Sorting
    The main question is Natural Sorting
    There are related solutions online, you can find it yourself

    reply
    0
  • Cancelreply