I have a table like below:
EmployeeId
EmployeeName
RequestId
RequestName
EmployeeId
RequestId
I need to a to assign requests in a sequential fashion(those who has mininum number of开发者_如何学运维 requests).
Can I know how to get employee who has minimum requests using linq???
Thanks, Mahesh
Assuming the class containing EmployeeID and RequestID (the third table) is named "Foo", it could be
(from f in db.Foos
group by f.EmployeeID into g
orderby g.Count()
select new { f.EmployeeID, g.Count() }).First()
This is drycoded and may be wrong. =)
精彩评论