Advertisement
elena1234

How to use double Select in T-SQL

Dec 27th, 2021 (edited)
4,946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.23 KB | None | 0 0
  1. SELECT * FROM
  2. (SELECT EmployeeID, FirstName, LastName, Salary, DENSE_RANK() OVER (PARTITION BY Salary ORDER BY EmployeeID) AS [Rank]
  3. FROM Employees
  4. WHERE Salary BETWEEN 10000 AND 50000) AS T
  5. WHERE T.Rank = 2
  6. ORDER BY Salary DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement