Babycat
Member
- Local time
- Today, 10:23
- Joined
- Mar 31, 2020
- Messages
- 275
Hi every,
I have tried to search if any similiar post, but I did not found what i need...
I have two tables as per attached picture, on the mainform there are 2 text boxes FromDate and ToDate to specify the exactly time period.
How to calcuate subtotal sale amount of a product between [FromDate; ToDate].
I dont know how to group by, can any one please help?
I have tried to search if any similiar post, but I did not found what i need...
I have two tables as per attached picture, on the mainform there are 2 text boxes FromDate and ToDate to specify the exactly time period.
How to calcuate subtotal sale amount of a product between [FromDate; ToDate].
I dont know how to group by, can any one please help?
Code:
SELECT TBLORDERDETAIL.ProductID, TBLORDER.CreatedDate, Sum(([Qty]*[Cost])) AS ExtPrice
FROM TBLORDER INNER JOIN TBLORDERDETAIL ON TBLORDER.OrderID = TBLORDERDETAIL.OrderID
GROUP BY TBLORDERDETAIL.ProductID, TBLORDER.CreatedDate;