Hi,
Supposing there is a simple data set as:
select 6 from dual union all
select 2 from dual union all
select 12 from dual union all
select 8 from dual union all
select 6 from dual
When i apply either distinct or group by the initial data set order is not kept.
with sample_data(data) as
(select 6 from dual union all
select 2 from dual union all
select 12 from dual union all
select 8 from dual union all
select 6 from dual)
select distinct data
from sample_data
-- group by data -- the same, the initial set order is not kept
How to keep the initial data set order leaving out the duplicate values?
In other words, the order should be:
6, 2, 12, 8
and not
6, 2, 8, 12
Db version: 11g v2
Thanks a lot,
Sim