注册 登录
编程论坛 MySQL论坛

[求助]SQL排序问题

kanoute 发布于 2007-11-06 08:49, 1749 次点击
我的 SQL语句是这样的:
select * from 表
where
id=5 or
id=105 or
id=201 or
id=43 ;

我并没加order by,但出来的结果是:他按id的先后顺序排列了,而我需要的是他按我查询的顺序排,即
5,105,201,43这样,而非5,43,105,201。有人知道怎样解决吗?
2 回复
#2
缘吇弹2007-11-08 17:34
试下:
select * from 表 where id=5
union
select * from 表 where id=105
union
select * from 表 where id=201
union
select * from 表 where id=43

#3
kanoute2007-11-08 18:06
这个我也试过了,我也以为行,但是。。。
1