Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 Linq 中重写这个 sql 语句。
select hand,count(hand) as Hands, deviceid from individualhands where deviceid = '977aed93-d1f1-4f7a-a6fa-6bc3ea7d863b' group by hand, deviceid
有人可以帮忙吗?:)
试试这个:
var query = individualHands .Where(r => r.deviceid == '977aed93-d1f1-4f7a-a6fa-6bc3ea7d863b') .GroupBy(r => new { r.hand, r.deviceid }) .Select(g => new { hand = g.Key.hand, deviceid = g.Key.deviceid, Count = g.Count() });