How to sort a same column both in asc order and desc order
问题 With an SQL Query how do we get the output of 2 columns, the first one being a column sorted in asc order and the second one with the order desc and both are same columns. ex: emp table: empid 1 5 9 4 The query output should be empid_1 empid_2 1 9 4 5 5 4 9 1 What OP tried so far WITH emp1 AS (SELECT ROWNUM a, empno FROM (SELECT empno FROM emp ORDER BY 1 ASC)), emp2 AS (SELECT ROWNUM b, empno FROM (SELECT empno FROM emp ORDER BY 1 DESC)) SELECT emp1.empno, emp2.empno FROM emp1, emp2 WHERE