Hello,
I have an object that contains these three properties: ID, DATE and NAME and want to query it with linq yielding the same results as if written in the sql statement below.
SELECT ID, MAX(DATE), NAME
FROM TABLE
GROUP BY ID
Here is what I have so far with linq:
var grouped = from a in table
group a by a.ID into g
select new fooObject()
{
DATE= g.Max(a => a.DATE),
NAME= g.Select(a => a.Name).ToString(),
ID= g.Select(a => a.ID)
};
Thanks in advance for any help.