› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
hellohacker
V2EX  ›  MySQL

mysql 根据传入的数据排序的问题

  •  
  •   hellohacker · Aug 5, 2014 · 4616 views
  •   You need to sign in to view this topic
    This topic created in 4434 days ago, the information mentioned may be changed or developed.
    如下:
    select count(*) as num from a where id in (11,12,9,4,15) group by id;

    这样输出数据后,不是按照 id的数据顺序 11,12,9,4,15 输出的

    求解决方案 3Q!
    3 replies  •  2014-08-05 11:54:25 +08:00
    yangqi
        1
    yangqi  
       Aug 5, 2014   ❤️ 3
    ORDER BY FIELD(ID,11,12,9,4,15)
    hcy
        2
    hcy  
       Aug 5, 2014   ❤️ 1
    order by field(id ,11,12,9,4,15)
    试下这个。
    hellohacker
        3
    hellohacker  
    OP
       Aug 5, 2014
    @yangqi
    @hcy

    3Q 2 位 问题已解决
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2559 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:28 · PVG 17:28 · LAX 02:28 · JFK 05:28
    ♥ Do have faith in what you're doing.