Find duplicates, sum and recombine!?!?!

SusanC

Registered User.
Local time
Today, 21:50
Joined
Feb 18, 2004
Messages
66
Hi everyone,
I have a query as below:

Row1 Row2 Row3 Row 4 Row 5
1, 2, 2 , 0 , 15
1 , 2 , 2 , 1 , 7
0 , 1 , 1 , 4 , 2
1 , 2 , 2 , 0 , 29


I need to pull our records which have the same entries in Rows 1-4 and then add up Row 5. For example The above query would make three more queries i.e
One
1,2,2,0, 44

Two
1,2,2,1, 7

Three
0,1,1,4, 2

I would then wish to recombine them into one table
Final
1,2,2,0, 44
1,2,2,1 , 7
0,1,1,4, 2.

Is this possible and how would I go about doing this!?
Been scratching my head for awhile now!
thanks eveyrone!
Sue
 
Just do it in one step using a group by query
To ceate a new table use

SELECT Field1, Field2,Field3, Field4, Sum(Field5) AS SumOfField5 INTO [YourNewTable]
FROM [YourTable]
GROUP BY Field1, Field2, Field3, Field4;

To just display the data use

SELECT Field1, Field2, Field3, Field4, Sum(Field5) AS SumOfField5
FROM [yourTable]
GROUP BY Field1, Field2, Field3, Field4;

HTH

Peter
 
Last edited:
thank you very much that has done the trick! much easier than I thought it would be!
 

Users who are viewing this thread

Back
Top Bottom