You can used more than one column to sort data by identify multiple columns in the ORDER BY clause.
FOR EXAMPLE
SELECT EMPNO,ENAME,JOB,DEPTNO
FROM EMP
ORDER BY DEPTNO,JOB;
EMPNO ENAME JOB DEPTNO
-------- ---------- --------- ----------
7934 MILLER CLERK 10
7782 CLARK MANAGER 10
7839 KING PRESIDENT 10
7788 SCOTT ANALYST 20
7902 FORD ANALYST 20
7369 SMITH CLERK 20
7876 ADAMS CLERK 20
7566 JONES MANAGER 20
7900 JAMES CLERK 30
7698 BLAKE MANAGER 30
7499 ALLEN SALESMAN 30
EMPNO ENAME JOB DEPTNO
-------- ---------- --------- ----------
7654 MARTIN SALESMAN 30
7844 TURNER SALESMAN 30
7521 WARD SALESMAN 30
No comments:
Post a Comment