Solved

Merge duplicate records in Access however sum total

Posted on 2009-03-29
3
1,546 Views
Last Modified: 2013-11-27
Hello,

I think I have a fairly simple query however have been struggling for a while so hope you can help. I have a query which displays 4 columns. In some instances the columns are exactly the same except for one column ie. the cost. The query may return as follows;

Name | CC | Nom | Cost
A | 100 | 008 | 38475.89
A | 100 | 008 | 22.56

What I would like is the query to return;

Name | CC | Nom | Cost
A | 100 | 008 | 38498.45

I thought the code posted below would work however has yet to merge any of the data.

Any help would be great. Thanks!
SELECT Query8.Type, Query8.dCostCode, Query8.dNominalCode, SUM([Query8.F7]) AS Budget

FROM Query8 LEFT JOIN SummaryTotal ON (Query8.dNominalCode = SummaryTotal.dNominalCode) AND (Query8.dCostCode = SummaryTotal.dCostCode)

GROUP BY Query8.Type, Query8.dCostCode, Query8.dNominalCode, Query8.F7;

Open in new window

0
Comment
Question by:Noobie1
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 24015324
You were very close:

SELECT Query8.Type, Query8.dCostCode, Query8.dNominalCode, SUM([Query8.F7]) AS Budget
FROM Query8 LEFT JOIN SummaryTotal ON (Query8.dNominalCode = SummaryTotal.dNominalCode) AND (Query8.dCostCode = SummaryTotal.dCostCode)
GROUP BY Query8.Type, Query8.dCostCode, Query8.dNominalCode
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 24015328
Not sure where SummaryTotal comes in but for the data above, this would give you the result you need.
SELECT Query8.Type, Query8.dCostCode, Query8.dNominalCode, SUM([Query8.F7]) AS Budget

FROM Query8 

GROUP BY Query8.Type, Query8.dCostCode, Query8.dNominalCode;

Open in new window

0
 

Author Closing Comment

by:Noobie1
ID: 31564146
Many Thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now