Vous pouvez le faire avec row_number()
et s'auto-joindre :
select e1.empid as empid_1, e2.empid as empid_2
from (select e.*, row_number() over (order by emp_id) as seqnum
from emp e
) e1 join
(select e.*, row_number() over (order by emp_id desc) as seqnum
from emp e
) e2
on e1.seqnum = e2.seqnum;
MODIFIER :
Vous pouvez également le faire avec rownum
mais cela nécessite un select
supplémentaire :
select e1.empid as empid_1, e2.empid as empid_2
from (select e.*, rownum as seqnum
from (select e.* from emp e order by empid asc) e
) e1 join
(select e.*, rownum as seqnum
from (select e.* from emp e order by empid desc) e
) e2
on e1.seqnum = e2.seqnum;