Click here to Skip to main content
15,063,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
/*Find All Customer Whose Purchase is Less then 10000 */

            var Customer = from c in _NorthWindDataContext.Customers
                           join o in _NorthWindDataContext.Orders on c.CustomerID               equals o.CustomerID
                           group c by c.CustomerID into CutGroup
                           where CutGroup.Sum(tab => tab.Orders.Sum(t=>            t.Order_Details.Sum(t1 => t1.Quantity * t1.Quantity))) < 10000
                           select new
                               CustomerID = CutGroup.Key,
                               Total = CutGroup.Sum(tab => tab.Orders.Sum(t => t.Order_Details.Sum(t1 => t1.Quantity *  t1.Quantity))),

/*I have solved it but if i want to access Order table information like orderid,region then how can i access... For your information i am binding customer obj to i can not use for each */
pls help me on this.....
Updated 10-Sep-11 21:29pm
Wendelius 11-Sep-11 3:29am
Pre tags added

1 solution

why not Join again with orders based on the key on the entire group. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900