Sir, I have a table name tbl_Employee
the contents are:-
emp.ID Name Salary
05 John 5000
08 Rose 4000
10 Mathew 6000
I want to display emp.Id ,Name and Salary of employee whom salary is second highest in this table
please send me the SQL Query
Loading

Pankaj PandeyPosted Jun 7, 2013, 1:03 AM
Bineesh ViswanathPosted Jun 7, 2013, 1:15 AM
This is absolutely correct answer to my question
Bineesh ViswanathPosted Jun 7, 2013, 12:51 AM
The Code is working correctly, but is there any query to display emp.Id and salary instead of row number and salary in the above query?
Pankaj PandeyPosted Jun 7, 2013, 12:30 AM
try it ..
SELECT * FROM (
SELECT ROW_NUMBER() OVER (ORDER BY SALARY DESC) AS rownumber,Salary
FROM tbl_Employee)
AS foo
WHERE rownumber = 2