易截截图软件、单文件、免安装、纯绿色、仅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','


相关问答:

jsp备份mysql只有空文件

用jsp做东西给完全不懂mysql的人用,可是备份时只有空文件,这是什么情况,
最好有源代码,谢谢
其实备份的过程我想大概是这样的:
将表A中的数据放到ArrayList中,然后将这个ArrayList中的数据再存到表B中。 ......

MySQL数据包过大

我用一个循环往数据库里面存文件,本来可以作为文件存放数据库里面只放文件的位置的,但是没有办法租的服务器网页空间大小有限制数据库没有限制。语句是这样的


public static final DataBase.MAXSIZE=102 ......

我要把注册信息提交到mysql中,要怎么办呢?

我在注册页面写入了如下代码:
<?php
    $conn=mysql_connect("localhost","root","614510")or die("数据库服务器连接错误".mysql_error());
& ......

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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号