首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
›
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
广告
V2EX
›
MySQL
mysql 根据传入的数据排序的问题
hellohacker
·
2014-08-05 11:28:50 +08:00
· 3411 次点击
这是一个创建于 3731 天前的主题,其中的信息可能已经有所发展或是发生改变。
如下:
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 条回复
•
2014-08-05 11:54:25 +08:00
1
yangqi
2014-08-05 11:34:18 +08:00
3
ORDER BY FIELD(ID,11,12,9,4,15)
2
hcy
2014-08-05 11:41:16 +08:00
1
order by field(id ,11,12,9,4,15)
试下这个。
3
hellohacker
OP
2014-08-05 11:54:25 +08:00
@
yangqi
@
hcy
3Q 2 位 问题已解决
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
3152 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms ·
UTC 12:40
·
PVG 20:40
·
LAX 05:40
·
JFK 08:40
Developed with
CodeLauncher
♥ Do have faith in what you're doing.