from i in Db.Items
select new VotedItem
{
ItemId = i.ItemId,
Points = (from v in Db.Votes
where b.ItemId == v.ItemId
select v.Poi
I think this is the same case. I resolved it. This is my solution:
var x = (from a in this.db.Pohybs
let sum = (from p in a.Pohybs
where p.PohybTyp.Vydej == true
select p.PocetJednotek).Sum()
where a.IDDil == IDDil && a.PohybTyp.Vydej == false
&& ( ((int?)sum??0) < a.PocetJednotek)
select a);
I hope this help.
If you don't like casting to nullabe decimal you could also try using Linq To Objects with ToList() method,
LinqToObjects Sum of empty collection is 0, where LinqToSql Sum of empty collection is null.