By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

Totals query divided per months

P: n/a

I have a query consiting of 2 columns : afid and SumOfLiters. The sql
view of the query is the following:

SELECT customers.afid, Sum([order details].liters) AS SumOfliters
FROM (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
GROUP BY customers.afid;
In the above query i view all the quantities sold up to now for each
afid. I want to view them divided per month.
Can somebody help me build a query showing the quantities sold per each
month?
There was a way with Format ?
Also, how shall i declare them to follow not the name of the month but
one by another, e.g. first to be january and second february?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JL
> SELECT customers.afid, format([order_date],"YYYYMM") as MonthYear,
Sum([order details].liters) AS SumOfliters
FROM (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
GROUP BY customers.afid, format([order_date],"YYYYMM")
ORDER BY 1,2;

"Peter yeshew" <fr*******@abv.bg> wrote in message
news:3f*********************@news.frii.net...
I have a query consiting of 2 columns : afid and SumOfLiters. The sql
view of the query is the following:

SELECT customers.afid, Sum([order details].liters) AS SumOfliters
FROM (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
GROUP BY customers.afid;
In the above query i view all the quantities sold up to now for each
afid. I want to view them divided per month.
Can somebody help me build a query showing the quantities sold per each
month?
There was a way with Format ?
Also, how shall i declare them to follow not the name of the month but
one by another, e.g. first to be january and second february?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.