I have a table that looks something like:
Favourite color | Favourite Food | Favourite Dance | Date
Now I want to group by favourite color and favourite food. Then take top 3 in each group ordered by date (the latest). I just cannot seem to get it to work using LINQ.
Like this:
from x in thingy
group x by new { x.Color, x.Food } into g
select new {
g.Key.Color,
g.Key.Food,
Items = g.OrderByDescending(x => x.Date).Take(3)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With