Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table where multiple record against one employee present,and there are a number of employee also. i want to get list of last records enter against all employee.


As you are having multiple records for multiple employees to find the latest record you have to use "Order By" clause with "Descending" property.

Then you have to use "Group By" clause to group your employees.

Then you have to select the "Partition By" record from the descending order based on the employeeID and select the top one record.

Hope you got the logic to implement the solution here.

For reference use this link.

Sisir Patro
Share this answer
var Employees = Emp.OrderByDescending(x => x.CreatedDate).GroupBy(x => x.EmpID).Select(x => x.First()).AsQueryable();

It will return the record of each EmployeeID with max Creation date.
Hope this helps you.

Share this answer
var records =
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900