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 equals
           select new
                      food =,
                      category = fif.category,
                      date =
           .orderbydescending(f =>

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