Lambda表达式去重
程序员文章站
2022-06-11 17:09:39
...
string sql = [email protected]"SELECT g.GroupID, g.GroupName,ge.EmployeeId,e.employeename FROM dbo.tab_UserGroup g
LEFT JOIN dbo.tab_GroupEmployee ge ON g.GroupId = ge.GroupID
LEFT JOIN dbo.tabEmployee e ON ge.EmployeeId = e.employeeid
WHERE g.EmployeeId = '{user.data.employeeid}'";
var result = db.SqlQueryable<GroupInfo>(sql).ToList();
var items = result.Where((x, i) => result.FindIndex(z => z.GroupID == x.GroupID) == i).ToList();//Lambda表达式去重