Xerox
06-06-2002, 02:51 AM
Hi
I have a query which totals up the sales of
each product between 2 dates. The problem is that I am getting every entry for products sold between the 2 dates entered by the user.
What i need is total sales of each product between 2 dates without showing every entry (Just the totals of each product), the sql query being used at the moment is:
SELECT DISTINCTROW OrdersCalc.ProductID, Sum(OrdersCalc.ExtendedPrice) AS [Sum Of ExtendedPrice], Sum(OrdersCalc.Weight_kg) AS [Sum Of Weight_kg], Sum(OrdersCalc.Weight_lb) AS [Sum Of Weight_lb], Products.ProductDescription
FROM (OrdersCalc INNER JOIN Orders ON OrdersCalc.OrderID = Orders.OrderID) INNER JOIN Products ON OrdersCalc.ProductID = Products.ProductID
GROUP BY OrdersCalc.ProductID, Products.ProductDescription, Orders.OrderDate
HAVING (((Orders.OrderDate) Between [Enter1] And [Enter2]));
any ideas how i can acheive this.
Many Thanks for all help.
I have a query which totals up the sales of
each product between 2 dates. The problem is that I am getting every entry for products sold between the 2 dates entered by the user.
What i need is total sales of each product between 2 dates without showing every entry (Just the totals of each product), the sql query being used at the moment is:
SELECT DISTINCTROW OrdersCalc.ProductID, Sum(OrdersCalc.ExtendedPrice) AS [Sum Of ExtendedPrice], Sum(OrdersCalc.Weight_kg) AS [Sum Of Weight_kg], Sum(OrdersCalc.Weight_lb) AS [Sum Of Weight_lb], Products.ProductDescription
FROM (OrdersCalc INNER JOIN Orders ON OrdersCalc.OrderID = Orders.OrderID) INNER JOIN Products ON OrdersCalc.ProductID = Products.ProductID
GROUP BY OrdersCalc.ProductID, Products.ProductDescription, Orders.OrderDate
HAVING (((Orders.OrderDate) Between [Enter1] And [Enter2]));
any ideas how i can acheive this.
Many Thanks for all help.