473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Totals query divided per months


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
1 3138
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: paul | last post by:
I have a query that takes monthly totals and rolls them up to get a balance at a specific time code eg: dt bucket mon_ttl --- ------ ------- 199903 ...
3
by: Paul Mendez | last post by:
Performance_Date SumOfBudget_NOI CurrYTD_BudgetNOI_Total 1/1/2004 $4,184,626.00 ? 2/1/2004 $4,484,710.00 ? 3/1/2004 $4,537,424.00 ? 4/1/2004 ...
4
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments...
6
by: KashMarsh | last post by:
Trying to show running totals on a report, except it needs to show one total amount and values being subtracted from it. For example, the report shows a Total Inventory amount (TotInvAmt). And...
9
by: MikeSA | last post by:
Hi I a trying to create a chart that reflects monthly cumulative totals from a query. The query fields show sales opportunities forecasted invoice date (OppForInvDate), Opportunity Description and...
6
by: leeg | last post by:
Help please. Apologies but I am poor in access and programming :o) and am having trouble getting my head around this one!!...again!!! I need to have a query or report to flag up someone who has...
2
by: Tom | last post by:
All: I have a report that lists quantities of stuff used over the course of a year and it is grouped on each month. In the group footer I want to insert the total for the month - easy stuff so...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
4
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.