New Posts New Posts RSS Feed: GroupBy with Sum
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

GroupBy with Sum

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: GroupBy with Sum
    Posted: 01-Dec-2012 at 7:12pm

I am trying to do a report that groups orders by date and sums them.

In SQL I would write: Select Sum(Orders.Amount) from Orders Group By Orders.Date

The sum works OK, but I don't see how to do the group by.

var op = this.EntityManager.Orders.AsScalarAsync().Sum(a=> a.Amount).GroupBy(a=> a.Date);

Greg
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 02-Dec-2012 at 6:40am
I found a good example here

Edited by gregweb - 02-Dec-2012 at 6:43am
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 03-Dec-2012 at 6:48am
Hi Greg.

Thanks for the update.

sbelini
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down