TSQL Challenge 1 - Solution By Jonathan Schultz



--Jonathan_Schultz_tbc_1.sql
SELECT	  EmployeeID
	, EmployeeName
	, Department
	, Salary
FROM	@Employees e0
WHERE	(SELECT Count(DISTINCT e1.Salary) FROM @Employees e1 WHERE e1.Salary >= e0.Salary AND e1.Department = e0.Department) = 2
ORDER BY Department, EmployeeID

Did you find something incorrect/wrong with this solution? Take a few seconds to Report It.

Did you understand how this solution work? If you find it difficult to understand, you can Request an Explanation or you can Write an explanation to help others better understand this solution.