I'm getting a sum of the checks that have been printed but haven't been cashed yet by checking 2 tabled in the database thru entitiyframework
I have tried multiple queries but I'm not too experienced in LINQ and I'm not getting the desired results, below is some of my implementations.
select sum(checks.Check_Amount) from dbo.ODC_Register checks left join dbo.vw_BMO_Daily cashed on checks.Check_Number = cashed.DCheckNo where cashed.Id is null and checks.Check_Date < '2019-9-3' This is what i tried last
var missing = from checks in Context.ODC_Register where(!Context.vw_BMO_Daily.Where(ma => Convert.ToInt32(ma.DCheckNo) == checks.Check_Number && checks.Check_Date <= ma.DatePosted).Any()) select new {checks.Check_Amount }; var missingSum = missing.Sum( x => x.Check_Amount); All I need is to find a way to make this into a LINQ query
select check_date, check_amount...` and do the group by/sum in linq, or would you use a window function?.FromSql(), and again query plan caching isn't unique to views is it?