How to get First Row of Each group in a Table
Microsoft Net Framework

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


Upcoming Articles
You may also read following recent Post
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM