Linq-to-entities: Easy to find max value in SQL, but difficult in LINQ?

I think this should work: var query = from item in db. T where item. FOO == 555 group item by item.

BAR into g select new { Bar = g. Key, Max = g. Max(x => x.

FOO_INDEX) } So basically you're taking the same approach as in the SQL: group the data, then take the key for the group and the maximum FOO_INDEX within the group.

I think this should work: var query = from item in db. T where item. FOO == 555 group item by item.

BAR into g select new { Bar = g. Key, Max = g. Max(x => x.

FOO_INDEX) }; So basically you're taking the same approach as in the SQL: group the data, then take the key for the group and the maximum FOO_INDEX within the group.

Thanks for the sample (it works), this is exactly what I needed. Thanks again! – xwraith Jul 21 '10 at 13:43.

You can group elements in LINQ to Entities the same way you do in SQL. The syntax would look something like: var q = from t in db. T where t.

FOO == 555 group t by t. BAR into g select new { Bar = group. Key, Max = g.

Max(b => b. FOO_INDEX) }.

Thanks for the help! – xwraith Jul 21 '10 at 13:42.

Max(r => r. Select new { t2. Result = record.BAR.

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