How to aggregate the following data-structure

S

Sebastian

Hi !

I am stumped with the following problem: I have a table
with the following structure:

Field1 Field2
1000 5
1000 15
1003 20
1003 1

etc. No primary key, just raw-data... Field1 contains an
article-number and field2 a count. is there an easy way to
create a query or new table wich contains just the number
and the total count for that item ?
eg.
1000 17
1003 21


Thanks

Sebastian
 
B

Brian Camire

Assuming you meant that the total for Field1 = 1000 in your example should
be 20 and not 17, you might try a query whose SQL looks something like this:

SELECT
[Your Table].[Field1],
Sum([Your Table].[Field2]) AS [Total]
FROM
[Your Table]
GROUP BY
[Your Table].[Field1]
 
S

Sebastian

-----Original Message-----
Assuming you meant that the total for Field1 = 1000 in your example should
be 20 and not 17, you might try a query whose SQL looks something like this:

SELECT
[Your Table].[Field1],
Sum([Your Table].[Field2]) AS [Total]
FROM
[Your Table]
GROUP BY
[Your Table].[Field1]
 
T

Tim Ferguson

have a table
with the following structure:
....

etc. No primary key,

Just to quibble: if there is no primary key then it's not a table.

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top