1
我很努力讓groupby在LINQ to SQL中工作,我對它很新穎......我試圖groupby g.id,但它不會工作......任何幫助都會不勝感激...乾杯GroupBy LINQ to SQL不起作用,或許
IQueryable<GuestList> query = from t in _ttx.Trips
join l in _ttx.Legs on t.Id equals l.TripId
join gl in _ttx.GuestLegs on l.Id equals gl.LegId
join g in _ttx.Guests on gl.GuestId equals g.Id
where t.Id == id
select new GuestList()
{
Id = g.Id,
Name = g.Name,
NoOfLegs = g.GuestLegs.Count()
};
我的結果是
1 paul 3
2 Jim 1
1 paul 3
1 paul 3
嗨Sampath,非常感謝您的回覆。它引導我回答:) – user3024760