WITH test AS
(
SELECT 7839 empno , 'KING' ename , 3000 sal FROM dual
UNION ALL SELECT 7788 , 'SCOTT' , 3000 FROM dual
UNION ALL SELECT 7902 , 'FORD' , 3000 FROM dual
UNION ALL SELECT 7566 , 'JONES' , 3000 FROM dual
UNION ALL SELECT 7698 , 'BLAKE' , 3000 FROM dual
UNION ALL SELECT 7782 , 'CLARK' , 1000 FROM dual
UNION ALL SELECT 7499 , 'ALLEN' , 1000 FROM dual
UNION ALL SELECT 7844 , 'TURNER' , 1000 FROM dual
UNION ALL SELECT 7981 , 'TOM' , 1000 FROM dual
)
select * from test
1 7839 KING 3000
1 7788 SCOTT 3000
1 7902 FORD 3000
1 7566 JONES 3000
1 7698 BLAKE 3000
2 7782 CLARK 1000
2 7499 ALLEN 1000
2 7844 TURNER 1000
2 7981 TOM 1000
이렇게 3000은 1등으로
1000은 2등으로 하고 싶은데 어떻게 해야하나요? |