unique records with summed quantities

T

Tom Ellison

Dear Olden:

This is your basic aggregate query, also called a totals query.

SELECT SKU, SUM(QTY) AS QTY
FROM YourTable
GROUP BY SKU

Notice that you cannot report the PURCHASE_ORDER, as it is not the same
across all the rows for each SQU. If you did include the PURCHASE_ORDER, it
would give the sum for each SKU/PURCHASE_ORDER combination. Unless you had
the same SKU twice within a PURCHASE_ORDER (which might never happen) it
would not be summing anything, just one row at a time. Perhaps you already
recognized that, as you did not ask for PURCHASE_ORDER in the output you
specified.

There is a good study for this in the online help. You may benefit from
observing this in the query design grid if you're already comfortable with
that feature. Just paste the code I gave into the SQL View of a new query
and save and name the query. Test it, and look at the Design View.

Tom Ellison
 
O

Olden

Hello everybody!

I need your help to refine what I'm looking for.

I have a table with the following fields: SKU,PURCHASE_ORDER,QUANTITY

Example:

SKU PURCHASE_ORDER QTY
78-95587 4556 1000
99-56852 4557 500
78-95587 4558 500

How would I extract unique SKUs but sum QTY

Below is the type of query output I'm seeking

SKU QTY
78-95587 1500
99-56852 500


What should I look into to make this happen?

Thanks in advance,

Olden
 

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