469,939 Members | 2,344 Online

# Combine 2 rows into one and add up the quantity

Hi all,

I have a table which list all the different product# and
quantity of the product in each row. But for some reason,
some of the product splites into 2 rows. For example;
Product A has a quantity of 30, then it will shows like this:

Product A 15
Product A 15

i want to combine them into: Product A 30

Every fields are the same except it splites the quantity into 2 rows.
So is there a way to combine all those splited rows and add up the quantity.
I'm don't want to do it manual because there at least thousand rows there.

I really need help on this, thanks

Kelvin
May 16 '07 #1
1 2420
8,800 Expert 8TB
Hi all,

I have a table which list all the different product# and
quantity of the product in each row. But for some reason,
some of the product splites into 2 rows. For example;
Product A has a quantity of 30, then it will shows like this:

Product A 15
Product A 15

i want to combine them into: Product A 30

Every fields are the same except it splites the quantity into 2 rows.
So is there a way to combine all those splited rows and add up the quantity.
I'm don't want to do it manual because there at least thousand rows there.

I really need help on this, thanks

Kelvin
Expand|Select|Wrap|Line Numbers
1. SELECT tblProducts.Product, Sum(tblProducts.Quantity) AS Total_Quantity
2. FROM tblProducts
3. GROUP BY tblProducts.Product
4. HAVING tblProducts.Product Is Not Null;
May 16 '07 #2