Linq query with nullable sum

前端 未结 14 1888
粉色の甜心
粉色の甜心 2020-11-29 06:23
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         


        
14条回答
  •  一生所求
    2020-11-29 06:59

    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.

提交回复
热议问题