I have a query that orders the customers in ascending order depending on the liters sold.How can i order the customers also per month.? For example if customer A is on the first place with the highest liters, i want to see his liters orderded also per month and the months also ordered in ascending order, staring from january.Also, how can i write January instead of 1 ?
My working query is the following :
SELECT customers.CompanyName, Sum([order details].liters) AS SumOfliters, customers.Customerid, affiliates.afid
FROM affiliates INNER JOIN ((customers INNER JOIN orders ON (customers.Customerid = orders.customerid) AND (customers.Customerid = orders.customerid)) INNER JOIN (products INNER JOIN [order details] ON (products.Productid = [order details].ProductID) AND (products.Productid = [order details].ProductID)) ON orders.orderid = [order details].OrderID) ON affiliates.afid = customers.afid
WHERE (((Month([invoicedate]))>1) AND ((Year([invoicedate]))=2007) AND ((orders.paymentid)=True))
GROUP BY customers.CompanyName, customers.Customerid, affiliates.afid
HAVING (((affiliates.afid)=1))
ORDER BY Sum([order details].liters) DESC;
-
query per month (Access 2000)
- This topic has 4 replies, 2 voices, and was last updated 17 years, 11 months ago.
AuthorViewing 0 reply threadsAuthorViewing 0 reply threads