我已经尝试过,但无法将此t-sql转换为linq。
select title , count(number) as order_number from order
group by title
它将是这样的:
var result = context.order
.GroupBy(p=>p.title)
.Select(p=> new {title = p.Key, order_number = p.Count()})