Solved

Merge duplicate records in Access however sum total

Posted on 2009-03-29
3
1,551 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

691 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