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

How to Join sum the values in two tables in access?

Hello,

I would be reallu grateful if someone could answer my question. I have two tables. The first table is with date and value. The same is another. e.g.
Table 1:
Date | Value|
1/1/2010 | 10
2/1/2010 | 10
3/1/2010 | 10
4/1/2010 | 10
5/1/2010 | 10
6/1/2010 | 10
7/1/2010 | 10
8/1/2010 | 10
9/1/2010 | 10
10/1/2010 | 10

Table 2:
Date | Value
3/1/2010 | 4
8/1/2010 | -2

I need to get the answer like this:
1/1/2010 | 10
2/1/2010 | 10
3/1/2010 | 14
4/1/2010 | 14
5/1/2010 | 14
6/1/2010 | 14
7/1/2010 | 14
8/1/2010 | 12
9/1/2010 | 12
10/1/2010 | 12

I need to take all the date values from table 1. Then according to date values in table 2, add or substract it to the values of table 1.
Is it possible to do that?
Mar 8 '11 #1
5 4166
Rabbit
12,516 Expert Mod 8TB
Take the union all of the query and then do an aggregate from that.
Mar 8 '11 #2
Thanks for the answer, but what aggregate function do you mean? DSum? When I do that I get those rows sumed where the date is the same. But I need to hold that value for the next records as I explained with an example in the question.
Mar 9 '11 #3
Rabbit
12,516 Expert Mod 8TB
I mean a regular sum query. You just need to join or union all the data first.
Mar 9 '11 #4
You see, if I use a regular sum query, I get such table

Date | Value|
1/1/2010 | 10
2/1/2010 | 10
3/1/2010 | 14
4/1/2010 | 10
5/1/2010 | 10
6/1/2010 | 10
7/1/2010 | 10
8/1/2010 | 8
9/1/2010 | 10
10/1/2010 | 10


I need to get this:
1/1/2010 | 10
2/1/2010 | 10
3/1/2010 | 14
4/1/2010 | 14
5/1/2010 | 14
6/1/2010 | 14
7/1/2010 | 14
8/1/2010 | 12
9/1/2010 | 12
10/1/2010 | 12
Mar 9 '11 #5
Rabbit
12,516 Expert Mod 8TB
In that case, you'll need to use a subquery to select the sum of the records from the second table where the date is less than or equal to the date in the first table.
Mar 9 '11 #6

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

Similar topics

4
by: Shahzad | last post by:
dear respected gurus, I would like to knew how to apply append,insert query for a self table where no primary keys issues. i do have problem say there are 5 rows of single record, this is data...
6
by: Maital | last post by:
Dear experts, I'm a beginner with ms-access. I have data from 3 years of observations on a certain field, divided into North and South sections. The first table has information for about 600...
5
by: jim | last post by:
Hi, I've browsed several posts, but still haven't found the answer I'm looking for. I have one table (A) that contains a list of values I want to return. I have two other tables (B) and (C)...
3
by: chaitanya02 | last post by:
I have problem joining four tables using Inner Join in ACCESS DB, I want to join 4 tables: 1, 2, 3 , 4 ....and query data in all these to see, i get a right url associated. sql1-account id,...
2
by: krishnasarma | last post by:
hi can any one tell me ........how to join two tables of different db(MSAccess) in Vb6 thanx in advance
3
by: kjewell23 | last post by:
Hi. I have look but can't find or understand what I need to do here. I need to join two tables together with a common field which is prdno Here is my code. please help me If I'm doing it wrong. ...
1
by: AccessHunter | last post by:
Please Help.... I have a query with 2 tables, LegalFile and Cases. LegalFile has the field CaseID(Number Field) and Cases has CaseNbr(Text Field). I am trying to find entries that are in...
1
by: AccessHunter | last post by:
Hi, I have a query to join two tables, Table1 - Case (Text), Division (Text) Table2 - CaseID (Text), Division Num (Number) Please help to convert (Number to text) and join the tables in the...
2
by: positivethinking | last post by:
Hello all I am working with oracle 10i I need to join 3 tables in 1 sql statements. (please see attached) it looks simple, but i have spent many hours without any luck, each table have 3...
1
by: arvindmishra | last post by:
i m inserting values in access database it displays message value is inserted but value is not ptresent in database. I m using following code OleDbConnection cnn = new OleDbConnection(); ...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.