两条查询语句的结果集不一样。求解
前提:
1、table01表内birthday字段为char(8),数据结构为yyyyMMdd。同样的数据存在
2、sql1与sql2查询出来的结果不一样
3、table01表中,只存在sts=‘01’的数据,不存在sts='02'的数据
----------SQL1------------
select rownum, t01.name, t01.birthday
from (
select name, birthday
from table01
where sts = '01'
order by birthday desc) t01
where rownum<=1000;
----------SQL2------------
select rownum, t01.name, t01.birthday
from (
select name, birthday
from table01
where sts = '01'
or sts = '02'
order by birthday desc) t01
where rownum<=1000;
为什么SQL1与SQL2的数据结果不一样?
运行环境:Oracle g11