mysql能不能按条件顺序确定查询结果顺序?该如何处理
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
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