ORACLE
[ORA] Oracle Distinct 문제..
Haronoid
2008. 3. 22. 21:54
최근 Distinct 가 행의 정렬 순서를 바꾼다는 사실이 발견..
2중 구조의 Select문에서 내부에 Order by 한 내용을 바깥에서 Distinct를 사용하면,
Order by 내용은 무시 된다.
Ex)
select distinct 1
from (
select 1 from dual
union all
select 3 from dual
union all
select 4 from dual
union all
select 2 from dual
union all
select 5 from dual
union all
order by 1
)
2중 구조의 Select문에서 내부에 Order by 한 내용을 바깥에서 Distinct를 사용하면,
Order by 내용은 무시 된다.
Ex)
select distinct 1
from (
select 1 from dual
union all
select 3 from dual
union all
select 4 from dual
union all
select 2 from dual
union all
select 5 from dual
union all
order by 1
)