zoukankan      html  css  js  c++  java
  • MySQL Field排序法


    检索 id = 2 or id = 5 or id = 9 or id = 56 or id = 38.
    然后按照 2 , 5, 9, 56, 38 这个顺序排列,这是题目要求
     
    以下为解决方案:
    1.SELECT * FROM `test` WHERE `id` IN(2,5,9,56,38) ORDER BY FIELD(`id`,2,5,9,56,38); (方案出自:http://www.phptext.net/article_view.php?id=199)
    2.select * case `id` when 38 then 57 else `id` end as myorder from test where find_in_set(`id`,2,5,9,56,38) order by myorder
    3.(此种不是很明白)
    (SELECT * FROM `account_biz` where  id = 2)
    UNION (select * from account_biz where   id = 5)
    UNION (select * from account_biz where   id = 9)
    UNION (SELECT * FROM `account_biz` where  id = 56)
    UNION (select * from account_biz where   id = 38);
     
     
     
  • 相关阅读:
    css--盒子模型
    目标爬取社会信用码
    KFC-位置分页爬虫
    百度翻译-爬虫
    网页采集器-UA伪装
    python模块2
    python模块
    go入门
    python垃圾回收机制
    Python高级用法
  • 原文地址:https://www.cnblogs.com/myphper/p/4284576.html
Copyright © 2011-2022 走看看