5
Answers

How to use average function with EF

Dave Bell

Dave Bell

1y
554
1

I have a Entity named "transactions" with {Id, RawDateTime, Score,SId}

I want to get a average of Score per day for records having SId. What as I doing wrong here?

_context.transactions.Where(b => b.SId == request.Id).GroupBy(a=>a.RawDateTime.Date).Include(b=>b.Average(v=>v.Score)).ToListAsync()

Answers (5)