473,549 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combine 2 rows into one and add up the quantity

2 New Member
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 2621
ADezii
8,834 Recognized Expert Expert
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
2564
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> The above is an example of some data I am displaying in a form on an ASP page. I need to allow the users to edit any of the rows displayed and...
2
4878
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 check the checkbox in the cooresponding field and click remove item. I would appreciate any insite. BTW Am using IE browsers only. Thanks!
13
1371
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, address, sex, car, telephone, spouse, health insurance etc. Would you create four rows, or one row with a quantity field, holding four? Why? Would you...
7
3375
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 either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the...
14
2398
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
985
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 Stock and the quantities, and I'm using a check box at the end of each row so the user can selected (so that item with the quantity will be deleted...
8
6910
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, aaa, bbb, 15 3, aaa, bbb, 3 Because the contents of fields 1 & 2 are the same in rows 2 and 3, I want to end up with...
2
5708
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 column is of nvarchar. When the rest of the columns for those rows are identical, I want to combine all of the values of that column into a single...
8
2903
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 data checking which rows are empty. I did something like this: <? $item_code1 = $_POST; $description1 = $_POST; $quantity1 = $_POST;
0
7457
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7723
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7965
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7483
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6051
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
771
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.