By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,678 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,678 IT Pros & Developers. It's quick & easy.

Combine 2 rows into one and add up the quantity

P: 2
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
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,607
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.