SELECT * FROm tbl_Employee
order by Salary
declare @N int
set @N=5
SELECT *
FROM tbl_Employee Emp1
WHERE (@N-1) = (
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM tbl_Employee Emp2
WHERE Emp2.Salary > Emp1.Salary)
order by Salary
declare @N int
set @N=5
SELECT *
FROM tbl_Employee Emp1
WHERE (@N-1) = (
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM tbl_Employee Emp2
WHERE Emp2.Salary > Emp1.Salary)
No comments:
Post a Comment