当前位置:Gxlcms >
数据库问题 >
C# linq group by 异常 -----MySqlException: Unknown column 'GroupBy1.K1' in 'field list'
C# linq group by 异常 -----MySqlException: Unknown column 'GroupBy1.K1' in 'field list'
时间:2021-07-01 10:21:17
帮助过:89人阅读
}).ToList();
正确的答案(MySql):
var result = (from si in model.table
group si by si.NumCores into grp orderby grp.Key
select new CoreCount {
Cores = grp.FirstOrDefault().NumCores, Count = grp.Count() }).ToList();
以上在MySQL亲测有效,SQL server没有测试。。。
C# linq group by 异常 -----MySqlException: Unknown column 'GroupBy1.K1' in 'field list'
标签:lis 答案 cores orderby mod sele mode mys result