How to get First Row of Each group in a Table
WITH FirstEmployeeOf_EachDepartment
AS
(
SELECT E.Employee_ID , E.Name,E.Age , E.Department_ID,
ROW_NUMBER () OVER (PARTITION BY E.NAME ORDER BY E.Employee_ID Desc) AS RN
FROM Employee E)
SELECT F.Employee_ID,F.Name,f.Age,f.Department_ID FROM FirstEmployeeOf_EachDepartment F
Where f.RN = 1
Share This with your friend by choosing any social account