I'm trying to run a Linq query which, in SQL, would look like this:
select V.Date, SUM(F.Factor/V.Change) AS Denom
from AllVols V JOIN Factors F on F.Key = V.FId
group by V.Date
The only way I found looks like this:
var denoms = from v in allVols
join f in factors on v.FId equals f.Key
group new {v.Date, Factor = f.Value, v.Change} by v.Date
into g
orderby g.Key.Date
select new {g.Key.Date, Denom = g.Sum(d => d.Factor/d.Change)};
No comments:
Post a Comment