C# and iOS Programming
Tips, tricks, snipplets, code examples
Thursday, February 18, 2010
Linq2Sql - Group By Count
public List
GetTotalRegisteredUserCount()
{
var qry = from aspnet_Profile profile in aspnet_Profiles
group profile by profile.Country into grp
select new {Country = grp.Key,
Count = grp.Select(x => x.Country).Distinct().Count()
};
return qry.ToList();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment