some query can't be supported

Aug 19, 2009 at 4:39 PM

from o in db.Orders
                     group o by new { o.CustomerID, o.OrderDate } into g
                     select new
                     {
                         g.Key.CustomerID,
                         g.Key.OrderDate,
                         Amount = g.Sum(item => item.Items.Sum(d=>d.Amount))
                     };

from o in db.Orders
                     group o by new { o.Cusotmer.CustomerCode, o.OrderDate } into g
                     select new
                     {
                         g.Key.CustomerCode,
                         g.Key.OrderDate,
                         Amount = g.Sum(item.Amount)
                     };

 

and can't support left/right/full outer join, but i have add some code to support it.

 

Aug 21, 2009 at 5:11 AM

from c in db.Customers
select new {sumamount = c.Orders.Sum(o=>o.Details.Sum(od=>od.Amount))}

Aug 21, 2009 at 10:03 AM

In fact you can do left outer join like this:

from cusomer in db.Customers

from order in db.Orders.Where(x=>x.CustomerID == customer.CustomerId).DefaultIfEmpty()

select new {customer, order};

 

 

Aug 22, 2009 at 9:35 AM
Edited Aug 22, 2009 at 9:45 AM

i have change source code and support left/right/full outer join now.