易截截图软件、单文件、免安装、纯绿色、仅160KB

mysql查询结果排序问题

我现在有一个表,item的表

表字段:id  text 

有一个array('5','3','1','2','4')

id中有值1 2 3 4 5 6 7 8 9 10,正常排序

我现在想要select id from item where id in ('5','4','1','2','3')

有没有方法使得select出来的id 不是按 1 2 3 4 5排序而是按5 4 1 2 3 也就是array的顺序


服务器端语言php.
select   id   from   item   where   id   in   ( '5 ', '4 ', '1 ', '2 ', '3 ')   order   by
instr( '5 ', '4 ', '1 ', '2 ', '3 ',id)

SQL code:
select id from item where id in ('5','4','1','2','3') order by locate(concat(',',id,','),',5,4,1,2,3,');



SQL code:
select id from item where id in ('5','4','1','2','3') order by find_in_set(id,'5,4,1,2,3')


没有用么...

=.=~



个人意见:建一个临时表存arry();
然后根据临时表联合查询,在根据他排序。
本人菜鸟 只能这样想.等待高手!

引用
SQL codeselect idfrom itemwhere idin ('5','


相关问答:

apache+PHP+mysql在win7下使用

如题,这三个在win7下使用会有什么兼容性问题吗?
由于我最近在使用win7,就懒得进xp了!
自己用windows 2008有一年多了,没出现任何问题。

win7测试版也用过,不会有什么问题的,放心。

当然你最 ......

mysql的连接超时时间怎么设置 - VC/MFC / 数据库

我是用mysql自带的C API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))

AfxMessageBox("数据库连接失败") ......

MYSQL 数据截取

MYSQL 截取一个数据表中,某一个字段(fulltext) 的前三百个字符,放到该表下另一个字段(introtxt)里.
求实现这个效果的命令
SQL code:
update 表 set introtxt=left(`fulltext`,300);

顶,学习

SQL code: ......

mysql 导致死机

环境:win2003 apache2 resin3 php5 mysql5
mysql错误里出现这个,服务器直接死到那里。
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_log ......

mysql的驱动程序

我有一个java环境下的程序,在本机运行正常,但发布到网的虚拟主机时不能连接数据库连接池
jdk 1.6 tomcat6.0.18 mysql5 mysqljdbc5.1.5
虚拟主机的技术人员说,只能配置局域的数据库连接池,也就是在M ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号