首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

mysql能不能按条件顺序确定查询结果顺序?该如何处理

2012-02-08 
mysql能不能按条件顺序确定查询结果顺序?select*fromt1whereid2orid1查询结果会是id12而我希望是和查询

mysql能不能按条件顺序确定查询结果顺序?
select   *   from   t1   where   id=2   or   id=1
查询结果会是
id
1
2

而我希望是和查询条件的顺序一样的
id
1
2

有没有函数能解决这个问题?不加字段的条件下

[解决办法]
select * from T where id=2
union all
select * from T where id=1

热点排行