I am using asp.net mvc 5 , Entity framework 5,

i have following tables:

1. orderid customerid 
      1          2
      2          3
      3          1

orderid   productname   quantity
   1        A                    10
   1        B                    15
   1        C                    20

i.e I want to make a report like following:

Total Quantity per customer:

                   total          total       total
                   Qty for        Qty for    Qty for

productname customer1 customer2 customer3
1.......................2.............3.............33
2.......................3.............2.............24
3.......................4.............22............34

i am using asp.net mvc 5, entity framework 5 ,linq

What do you need? A SQL query or LINQ?

SQL would be something like this:

SELECT P.ProductName, O.CustomerId, SUM(P.Quantity)
FROM Product P, Order O
WHERE P.OrderId = O.OrderId
GROUP BY P.ProductName, O.CustomerId
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.