Suppose I have a table named EMPLOYEE containing the following attributes
(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, MIDDLE_NAME, JOB_ID, MANAGER_ID, Salary)
Can I Display the Nth highest salary drawing employee details Please help
Test Table
CREATE TABLE Test (ID INT IDENTITY(1,1), Salary INT) INSERT INTO Test VALUES (100), (200), (300), (400), (500) SELECT * FROM Test Query
SELECT TOP 1 Salary FROM (SELECT TOP 3 Salary FROM Test ORDER BY Salary DESC)q ORDER BY Salary ASC In your Sub-query SELECT TOP Nth the rest remains the same and it will get you the desired results
first record with 'N-th' salary, orall records with N-th salary?