I have a table with the details of property
------------------------------------------------
Id | Propertyname |date_created |Price |agent_name
------------------------------------------------
1 |xxxxxx |17-06-2015 |10000 |abc
2 |xxyyyyy |15-06-2015 |10000 |abc
3 |xxyyyyy |16-06-2015 |10000 |bcd
4 |xxyyyyy |15-06-2015 |10000 |bcd
5 |xxyyyyy |17-06-2015 |10000 |cde
6 |xxyyyyy |15-06-2015 |10000 |cde
I want a result at
------------------------------------------------
Id | Propertyname |date_created |Price |agent_name
------------------------------------------------
1 |xxxxxx |17-06-2015 |10000 |abc
3 |xxyyyyy |16-06-2015 |10000 |bcd
5 |xxyyyyy |17-06-2015 |10000 |cde
I want a result with distinct of agent_name with full row details
I tried below code
var property =
from l in properties
group l by l.agent_name into g
let lastUsed = g.OrderBy(x => x.date_created).Last()
select lastUsed;
Adove code displayed error
LINQ to Entities does not recognize the method 'properties Lastproperties' method, and this method cannot be translated into a store expression.
Anyone know how to solve this