bschwarting
asked on
ASP Classic - Loop Count
I have some sales data, and each record has a purchase date. I have multiple sales on each day, and want to count up how many sales per day based on the purchase date. What's the best approach to be able to count them up, then print the results to the page?
Dim conn
Set conn = Server.CreateObject("ADODB.recordset")
conn.open "select * from [DAL.ProductContext].[dbo].[SoldItems] ORDER BY PurchaseDate DESC", "DSN=dashboard"
"select all, your, tables, mydatecount = (select count(*) from [dbo].[SoldItems} where PurchaseDate like 'yourdate') from [DAL.ProductContext].[dbo] .[SoldItem s] ORDER BY PurchaseDate DESC", "DSN=dashboard"
ASKER
How do I go to the next date and count those, if I used SQL? There could be 50 days of sales.
ASKER
Ryan Chong, I have yours implemented, but don't know how to write it out. Can you assist?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are amazing!!!! That worked perfectly!!! Exactly what I wanted!!! THANK YOU!!!
1. do the calculation in SQL,
Open in new window
2. and display the results accordingly (assuming you already know how to do this)