我在 linq 中编写了这个查询,我想在选择新的 2 减时间跨度中执行这项工作 1-sum x 和 y,并在一个数字中进行多重播放,例如 30
var query =
(from c in DB.SabtHoghoghs
join aa in DB.SabtHesabKarmands on c.KarmandID equals aa.KarmandID
select new
{
c.Karmand.FName,
c.BabatMah,
x = DB.SabtHesabKarmands.Where(q => q.BabatMah.Year == c.BabatMah.Year &&
q.BabatMah.Month == c.BabatMah.Month && q.HesabKarmand.HesabKarmandTypeID==1)
.Sum(aaa => aaa.Tedad * aaa.HesabKarmand.Mablagh),
y = DB.SabtHesabKarmands.Where(q => q.BabatMah.Year == c.BabatMah.Year &&
q.BabatMah.Month == c.BabatMah.Month && q.HesabKarmand.HesabKarmandTypeID == 2)
.Sum(aaa => aaa.Tedad * aaa.HesabKarmand.Mablagh),
z=y-x //how to do this(1)
karkard = (c.Karmand.ExitTime-c.Karmand.EnterTime).Hours *30 //how to do this(2)
}).Distinct();