Use
GroupBy
with a key that contains your grouping properties. Then select
out the key properties along with the count of each from the grouping.var query = tsgdbcontext.Products
.GroupBy(p => new {
p.ProductId,
p.ProductName,
p.ProductPrice
})
.Select(g => new {
g.Key.ProductId,
g.Key.ProductName,
g.Key.ProductPrice,
Available = g.Count()
});
No comments:
Post a Comment
Note: only a member of this blog may post a comment.