我想分組,並仍然檢索表中的所有數據。我對Linq還很陌生,似乎無法告訴我做錯了什麼。我不僅想對結果進行分組,而且還想檢索表格中的所有列。這可能嗎?返回完整結果linq分組查詢
(from r in db.Form
orderby r.CreatedDate descending
group r by r.Record into myGroup
where myGroup.Count() > 0
where (r.CreatedDate > lastmonth)
where r.Name == "Test Name"
select new { r, myGroup.Key, Count = myGroup.Count() }
)
一些如何「r」失去其上下文或自從我分組「r」它已被替換。不確定。
感謝@RePierre,它像一個魅力一樣工作! – 2012-04-17 16:26:12