Thursday, January 5, 2017
SQL Server - How to find the nth Highest salary from Employee Table
CREATE TABLE Employee_Test
(
Employee_ID INT,
Employee_name Varchar(100),
Employee_Salary Decimal (10,2)
);
INSERT INTO Employee_Test VALUES (1,'Anish',1000);
INSERT INTO Employee_Test VALUES (2,'Sushant',1200);
INSERT INTO Employee_Test VALUES (3,'Rakesh',1100);
INSERT INTO Employee_Test VALUES (4,'Manoj',1300);
INSERT INTO Employee_Test VALUES (5,'Amit',1400);
INSERT INTO Employee_Test VALUES (6,'Lokesh',1600);
INSERT INTO Employee_Test VALUES (7,'Maneneder',1400);
INSERT INTO Employee_Test VALUES (8,'Narendra',400);
INSERT INTO Employee_Test VALUES (9,'Kaushal',1900);
INSERT INTO Employee_Test VALUES (10,'Vikas',3400);
INSERT INTO Employee_Test VALUES (11,'Sudhir',800);
go
select * from Employee_Test
go
select * from Employee_Test emp1
where 1=(select COUNT(distinct(emp2.employee_salary))
from Employee_Test emp2
where emp2.Employee_Salary>=emp1.Employee_Salary
)
go
Subscribe to:
Post Comments (Atom)
Search This Blog
DAX - Grouping on multiple columns and the count
Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...
-
We can filter an axis based on the members, or based on the measure value. Based on the members: begins with F or after Based on th...
-
Incremental Uploads: We have got a request to need a SSIS package to incremental uploads between two sql server instances which are two d...
-
Follow the below link https://blogs.msdn.microsoft.com/arvindsh/2013/04/23/cannot-resolve-the-collation-conflict-error-message-with-tem...
No comments:
Post a Comment