469,939 Members | 2,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,939 developers. It's quick & easy.

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
ADezii
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

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Colin Steadman | last post: by
2 posts views Thread by Spanky | last post: by
13 posts views Thread by Lyle Fairfield | last post: by
14 posts views Thread by imani_technology_spam | last post: by
reply views Thread by Bruno Alexandre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.