Delete duplicates using Lambda

后端 未结 4 1554
南笙
南笙 2021-01-23 01:23

I need some help using a lambda expression to remove duplicate entries in my Entity Framework context. I have a table with the following columns:

Id, DateOfIncide

4条回答
  •  有刺的猬
    2021-01-23 01:59

    var query = db.Incidents.Where(x => x.IsAttendanceIncident == "Y").GroupBy(x => new { x.EmployeeId, x.DateOfIncident, x.IsAttendanceIncident })
         .SelectMany(x => x.Skip(1));
    

提交回复
热议问题