group by 并且 count(1)的linq写法

时间:2023-03-08 16:44:22

SELECT [MobleNo],count(1)
FROM [CustMobleNo]
group by [MobleNo]
GO

===作用等于===

var rst = from c in dataContext.CustMobleNo
group c by c.MobleNo into g
select new
{
mobile=g.Key,
total=g.Count()

};