473,387 Members | 1,790 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,387 software developers and data experts.

Access summing items by month

Hello everybody, I have the following question:

Lets say we have a tables where we record sales of cars:

TABLE1
order_id
customer_id
order_date

TABLE2
order_id
product_id
quantity

TABLE3
product_id
product_name
product_price
product_model

Relationships between tables are as follows: TABLE1 one-to-many TABLE2, TABLE3 one-to-many TABLE2.

My question is how to make a query which can say how many particular models were sold in specific month and what was the cost of those sales. The trick is that order_date is in normal date format like dd/mm/yy.

I have tried variety of COUNT operations in my queries but everything seems to be doing something wrong and results are far from what I need.
Apr 19 '07 #1
2 1222
nico5038
3,080 Expert 2GB
Looks to me you should first create a query with a JOIN between table1 to table2 and a JOIN between table2 to table3.
For the Datefield use in the query:
Year(order_date) & right("00" & Month(order_date),2) as YearMonth

Now you can use that query to select the model and make and create a GroupBy query to sum the number of models.

Getting the idea ?

Nic;o)
Apr 23 '07 #2
NeoPa
32,556 Expert Mod 16PB
To get an output field to sort and group on, use :
Expand|Select|Wrap|Line Numbers
  1. Format([Order_Date],'yyyymm')
This will provide a result which is unique per month and also will sort in month order.
Let us know if you have any difficulty putting a basic query together with that.
Apr 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dagpauk | last post by:
Assume the following table holding information about the planning date and execution date for an imaginary "objects" ObjectPlan ObjectID PlannedDate ExecutedDate 1 19.03.04 28.03.04...
2
by: HS Hartkamp | last post by:
Hi all, I have a table with analysis-results for various months. An item can -for a particular month- have the result 'list1', 'list2' or 'list3' depending on the result of the analysis. ...
1
by: Nathan Sokalski | last post by:
I have a problem that is driving me crazy. I have a User Control composed of three DropDownLists that will be used to select a date. I have everything working except for one thing. When I select a...
2
by: MrL8Knight | last post by:
I am building a simple shopping cart and I am having problems trying to add the costs of the items to generate a total cost. I am new at this so forgive me if my technical verbiage isn’t the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.