2011-05-13 150 views
0

我有一個員工表,其中包含字段 - EmpId,EmpName,Salary。 表包含8條記錄。現在我想獲得第三高的薪水。 可以請你爲需要幫助Oracle查詢

+0

我得到了第二高的薪水與下列查詢 - 選擇MAX(工資)從員工薪酬「提供的查詢,其中工資<(選擇最大(從職工薪酬)); – 2011-05-13 14:46:44

回答

1
select * 
from (select * 
     from employee 
     order by salary desc) 
where rownum = 3; 
+0

謝謝奧拉夫,我想第三最高工資不是第三個記錄 – 2011-05-13 14:45:34

+0

謝謝奧拉夫,您的查詢正在工作。我對您的查詢感到困惑 – 2011-05-13 14:51:40

0
select * from (select DISTINCT salary from employee order by salary desc) where rownum = 3;