我有一个如下的SQL:
select catalog,queryname,count(*) from table group by catalog,queryname
现在我如何在linq中编写并获取计数?
感谢
答案 0 :(得分:1)
var g =
from record in table
group record by new
{
record.catalog, record.queryname
} into mygroup
select new
{
catalog = key.catalog,
queryname = key.queryname
count = myGroup.Count()
};