Linq to entities query for count and group by with join on 2 tables?

Try this: var assetTypes = context.AssetTypes. Where(a => a.AssetClass. Id == 7).

Select(a => new { a. Name, a. AssetTypeId, CountOfAssets = a.Asset.Count()).ToList() I hope you have foreign keys in your base and model graph is created properly.

Try this: var assetTypes = context.AssetTypes. Where(a => a.AssetClass. Id == 7).

Select(a => new { a. Name, a. AssetTypeId, CountOfAssets = a.Asset.Count()).ToList(); I hope you have foreign keys in your base and model graph is created properly.

Thanks for the solution Lukled.. The model graph has the proper associations and your solution works – samsur May 9 '10 at 5:26.

LINQ to Entities Query for selecting a content from co table and joining this table with cotypes whereco. Cotype ='somevalue' and c. SomeId is Max?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions