asp recordset loop?

Hey guys,
I have a database that has a few fields, you can see them in the image I provided below.  I am hoping there is some magic code available to loop through the recordset, counting the quantities of each sku.

I was hoping to be able to count the quantity of each sku.

I hope that makes sense!  
Untitled-1.gif
LVL 4
Slim81Asked:
Who is Participating?
 
Lee W, MVPConnect With a Mentor Technology and Business Process AdvisorCommented:
I would expect this should work:

for an individual item
SELECT SUM(Prod_Qty) FROM Order_Details WHERE prod_sku = 3013

Or
SELECT Prod_SKU, SUM(Prod_Qty) FROM Order_Details GROUP BY Prod_Sku
(I'll check this, I think that's it... my SQL is a little rusty).
0
 
muratkanikCommented:
just update your sql query as below and then you will get the attached result

SELECT sum(prod_qty), Prod_sku
  FROM [KatkiDB].[dbo].[order_details] group by Prod_sku
result.JPG
0
 
muratkanikCommented:
if you would like to have a column name you can use it as

SELECT sum(prod_qty) as total_quantity, Prod_sku
  FROM [KatkiDB].[dbo].[order_details] group by Prod_sku
0
 
Slim81Author Commented:
You are a pro!  Awesome!  I used the second option.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.