I search a lot but i can not find. I want to use "select distinct" in entity framework.
my tables are:
scopes:scopeID,ScopeName
sports:sportID,sportName
Events:eventID,scopeID,sportID
public List<Event> GetAllEvents(int sportID)
{
using (var mycontext= new MysiteEntities())
{
result= mycontext.Events
.Where(l => l.SportID == sportID)
.OrderBy(l => l.ScopeID)
.ToList();
}
return result;
}
it return duplicate record by one scopeID.
events:
eventID scopeID sportID
1 12 2
2 12 2
3 13 1
4 13 2
5 13 2
i want this result from:scopeID=12 and soprtID=2
1 12 2
3 13 2
how can do it?i want to return list from function.
thank you in advance.