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.
我正在使用 c# 从 sql 查询中填充数据表。它有两列
env issud Dit x Dit x Sit y
linq 查询的输出应分组 env 和 issue Dit 2 Sit 1 的计数
听起来你想要:
var query = table.GroupBy(x => x.env) .Select(g => new { Env = g.Key, Count = g.Count() };
或作为查询表达式:
var query = from row in table group row by row.env into g select new { Env = g.Key, Count = g.Count() };