Solved

Merge duplicate records in Access however sum total

Posted on 2009-03-29
3
1,548 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mysql Left Join Case 10 55
T-SQL Default value in Select? 5 27
LAG_ROWID - how do I get the right order using this query? 2 5
Merge two rows in SQL 4 14
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

809 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