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
发布时间: 2012-02-08 19:52:21 作者: rapoo
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