79824687

Date: 2025-11-19 16:12:08
Score: 1
Natty:
Report link

I would try using window functions.

A way using FIRST_VALUE could be something like:

SELECT DeptID, EmployeeName, Department, FIRST_VALUE(ManagerName) IGNORE NULLS OVER(PARTITION BY DeptID) AS ManagerName
FROM #Employee_Manager
WHERE EmployeeName IS NOT NULL 
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Manel Caireta