|
|
-
I like your answer, its most unique... :)...
|
-
if we have two employees with max salary it will fail, instead of employeeid in count you can use 'distinct count(salary)'...
|
-
question is to get second highest salary for EACH department... did you check your result......
|
-
you would be in difficulty if user change requirement to ask 10th highest salary for department.......
|
-
This will not work in all scenarios, this is on assumption that there will be only one row with highest salary person.
for example add below row in sample data and run query
INSERT INTO @Employees(EmployeeName, Department, Salary)
VALUES('Eshant','...
|
-
eshant.garg Liked 10 Months ago through Pages
We wish to use these pages for publishing various documents, announcements, FAQ etc related to beyondrelational.com...
|
-
Solution to TSQL Beginners Challenge 1...
|
-
this will give you result only if two members have same salary, but in question you need to find all members with same salary.
let's add below one more member in table and your query will not show this member.
INSERT INTO #employees(EmployeeName,...
|
-
<p>The challenge is to find the employees with the second highest salary in each department. However, it is a little more complicated because if two employees have the same salary, you need to list both of them.</p>...
|