find nth highest salary in sql
  • i have one table in sql server the of table EmpDetails in table have 1 colums value and following records are in table

    ======
    Salary
    ======
    100000
    90000
    80000
    70000
    60000

    i want to get forth top Value i have one Query but query returs 2rd recode like 80000 kindly solve this query
  • 3 Comments sorted by
  • try this query.

    Select T.Rowid,T.Salary from
    (
    Select Row_number() over (order by salary asc) as Rowid,Salary from mytable
    )
    where T.Rowid = 4
  • after the execute this Query giveing me Error

    Msg 156, Level 15, State 1, Line 5
    Incorrect syntax near the keyword 'where'.
  • now try it.

    Select T.Rowid,T.Salary from
    (
    Select Row_number() over (order by salary asc) as Rowid,Salary from mytable
    ) t
    where T.Rowid = 4

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week