How to sum multiple rows of data for a particular part # and work area combination?

L

Liz M.

Hello -
I could really use some help with writing a query. I can't imagine that it is that difficult, I just have tried everything I can think of and I am stumped for the time being.

Here's what my input data might look like:
Work Area Part # Qty
A 1 1
A 1 2
A 1 3
B 1 1
B 1 2
B 2 5
B 2 2

I need to write a query that will first group by work area and then by part #. Then it will sum up the quantities by part # by work are. So my results would look something like this:

Work Area Part # Qty
A 1 6
B 1 3
B 2 7

Can someone help with this?
Your help will be greatly appreciated!!!
Thank you in adavance,
Liz M.
 
B

Brian Camire

You might try a query whose SQL looks something like this:

SELECT
[Your Table].[Work Area],
[Your Table].[Part #],
Sum([Your Table].[Qty]) AS [Qty]
FROM
[Your Table]
GROUP BY
[Your Table].[Work Area],
[Your Table].[Part #]

This assumes your table is named "Your Table".

Liz M. said:
Hello -
I could really use some help with writing a query. I can't imagine that
it is that difficult, I just have tried everything I can think of and I am
stumped for the time being.
Here's what my input data might look like:
Work Area Part # Qty
A 1 1
A 1 2
A 1 3
B 1 1
B 1 2
B 2 5
B 2 2

I need to write a query that will first group by work area and then by
part #. Then it will sum up the quantities by part # by work are. So my
results would look something like this:
 
L

Liz M.

Brian -
Thank you very much for your help. The SQl statement did what I was looking for

Thank you so much!
Liz M

----- Brian Camire wrote: ----

You might try a query whose SQL looks something like this

SELEC
[Your Table].[Work Area]
[Your Table].[Part #]
Sum([Your Table].[Qty]) AS [Qty
FRO
[Your Table
GROUP B
[Your Table].[Work Area]
[Your Table].[Part #

This assumes your table is named "Your Table"

Liz M. said:
Hello
I could really use some help with writing a query. I can't imagine tha
it is that difficult, I just have tried everything I can think of and I a
stumped for the time being
Work Area Part # Qt
A 1
A 1
A 1
B 1
B 1
B 2
B 2
part #. Then it will sum up the quantities by part # by work are. So m
results would look something like this
 

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