I have 4 Tables in my SQL server DB . OrderMaster,OrderDetails,ItemMaster,ManufacturerMaster
OrderMaster ( OrderId [primaryKey],Orderdate,TotalAmount,SupplierName) OrderDetails (OrderDetailId[primaryKey],OrderId,Item_Id,Quantity,ManufacturerId) ItemMaster (Item_Id [primaryKey],ITem Name,ITemCost,) ManufacturerMaster (ManuId[primaryKey],ManufacturerName,HandlingFees)
The Relations are OrderDetails table Order id is refering the primary key of OrderMAster table(one to many) OrderDetails table Item_Id is refering the primary key of ItemMaster ManufacturerIdtable Order id is refering the primary key of ManufacturerMaster
Orderdetails table can have many records for one record in ORderMaster table.
Now i want to have a Query to List all Orders which;s orderdate=05/01/2009 with the below Items as columns values
1 . Order number
2 . Total Number of Items (number of child records in orderdetail table) for each order
3 . Total (Sum of )ITemcost for all the items in an order.
How to do the Order by ??