How can I convert the following SQL from this article:
select type, variety, price
from fruits
where price = (select min(price) from fruits as f where f.type = fruits.type)
I tried it this way:
ctx.Fruits.
Where(f => f.Price == ctx.CreateObjectSet<Fruit>().
Where(f1 => f1.Type == f.Type).Min(f1 => f1.Price));
but it doesn’t work because ctx.CreateObjectSet can not be translated to SQL.
Why not just