Hi
In the emp table we want third heighest salary in this table by sql command
How to find the third heighest salary of emp table?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Dhaval PatelRank #1,023 · 1.9K reputationPosted Jan 19, 2012, 7:31 PM EST
refer below link
http://www.c-sharpcorner.com/Blogs/7111/how-to-get-second-highest-and-lowest-record-in-sql-server.aspx
use this query
SELECT Temp_id from TblTemp c1 WHERE 3=(SELECT count(*) from TblTemp c2 WHERE C1.Temp_id >= C2.Temp_id )Thanks
Dhaval Patel
This post help you than Mark As Accepted Answer
Mukesh KumarRank #615 · 3.9K reputationPosted Jan 19, 2012, 7:40 PM EST
Try this
SELECT TOP 1 salaryFROM (
SELECT DISTINCT TOP 3 salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 19, 2012, 8:15 PM EST
select distinct(salary) from employee A where 3=(select count(distinct(salary)) from employee B where A.salary<=B.salary)
Thanks