sql语句对应查询
select a,count(a) from table where b=2 group by a order by count(a) desc
var a = (from j in db.GoodsRelation
where j.GoodsInfo_Id1 == GoodsInfoId
group j by j.GoodsInfo_Id2 into g
orderby g.Count() descending
select new { Name= g.Key, Count = g.Count() }).Take(10).ToList();
a是一个列表,每个元素对应两个字段Name、Count