score:3

Accepted answer

try this, assuming your entities are db.foodiate and db.foodinfridge (loving the table names!):

var food = (from fif in db.foodinfridge
           join fia in db.foodiate on fif.food equals fia.food
           select new
                  {
                      food = fif.food,
                      category = fif.category,
                      date = fia.date
                  })
           .orderbydescending(f => f.date)
           .tolist()

that way you have the food in order of date eaten, most recent first. then if you want the top three of them, you can do (make sure you check that the food list is longer/same size as the number you are taking though, otherwise it'll die!):

var topfood = food.take(3).tolist();

Related Query

More Query from same tag