Link to home
Start Free TrialLog in
Avatar of Slim81
Slim81Flag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of muratkanik
muratkanik

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
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
Avatar of Slim81

ASKER

You are a pro!  Awesome!  I used the second option.  Thanks!