Looking for a JavaEE Architect or Potential Tech Co-Founder?
Please don't hesitate to contact me.

How to execute select count(*), field from table group by field in entity framework

As the title implies we will try to convert a native sql that group and counts the number of row. We will assume that you have a column quantity or number of items.
//native query
select count(*), field
from table
group by field

//entity framework
var query = model.GroupBy(p => p.Field).Select(o => new { o.Key, Count = o.Sum(p => p.Quantity) });
How to execute select count(*), field from table group by field in entity framework How to execute select count(*), field from table group by field in entity framework Reviewed by Edward Legaspi on Wednesday, March 07, 2012 Rating: 5

No comments:

Powered by Blogger.