473,383 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 2607
ADezii
8,834 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

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

Similar topics

2
by: Colin Steadman | last post by:
Part No Description Quantity 45643 Random part 10 45678 Another Random part 7 98944 And another 1 <submit button> ...
2
by: Spanky | last post by:
Thanks for any help in advance! I have this order form where you add rows as you need them. The routine to add fields is working fine. I am trying to add the ability to delete rows if you...
13
by: Lyle Fairfield | last post by:
Suppose there are four identical rows in a table, save for some unique id which identifies each row. For example, John Doe and his three clones live in the same home, share the same dob, name,...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
14
by: imani_technology_spam | last post by:
I have the following table; CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (7200) COLLATE SQL_Latin1_General_Pref_CP1_CI_AS NOT NULL , CONSTRAINT PRIMARY KEY CLUSTERED ( ,
0
by: Bruno Alexandre | last post by:
Hi Guys, I manage to do what I want with the GridView, using DataTable to popultate the GridView with just the products from the Office Stock I just show the products that the Office have in...
8
by: cycleops | last post by:
Can anyone please help? I'm trying to combine 2 or more similar rows into one row, accumulating a field for quantity. E.g.: index, field1, field2, quantity 1, ccc, bbb, 5 2, ...
2
denny1824
by: denny1824 | last post by:
Hi everyone, Here is my problem. I have a Table Variable (I could easily turn it into a Temp Table instead) that will sometimes have rows that are identical except for one specific column. The...
8
by: backups2007 | last post by:
I'm using php/mysql to develop a program. What I need to do is create an insert query that would be able to insert at least 9 rows of data from input text boxes. But of course, before inserting the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.