2

我有这个查询:

from e in Employee
join t in TimeTable
    on e.Id equals t.EmpId
group new {e,t} by e.Id into g
orderby g.Key
select new 
{
  Emp = g.Key, 
  Items = g.Select(c => c.t.OtherTable.Somevalue).Distinct()
}

Employees它工作正常,但我需要反转分组,以便它将全部分组OtherTable.Somevalue

我怎么做?

4

1 回答 1

2

可能喜欢遵循这个它会起作用

from e in Employee
join t in TimeTable
    on e.Id equals t.EmpId
group new {e,t} by t.OtherTable.Somevalue into g
orderby g.Key
select new 
{
  SomeValue = g.Key, 
  Emplyees = g.Select(c => c.e.Id).Distinct()
}
于 2013-03-07T13:50:47.523 回答