The the fastest way would be to use a query with the COUNT function to count how many products there are in each market. Example:
Code:
SELECT COUNT(market) AS marketCount FROM tableName WHERE market = 'Electronics'
You would have to run the query for each individual market, but if you're looping through the markets already, this shouldn't be too big a of a deal. If you're using a database other then access, you might be able to use the COUNT function in conjunction with the DISTINCT function, which would save you a lot of trouble, so let us know if you're not using access.
A quick (and dirty) example:
Code:
Set varRsMarkets = Server.CreateObject("ADODB.Recordset")
Set varRsMCount = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT market FROM marketsTable"
varRsMarket.Open strSql, yourConnection
While NOT varRs.EOF
strSql = "SELECT COUNT(market) AS marketCount FROM productTable WHERE market = '" & varRs("market") & "'"
varRsMCount.Open strSql, yourConnection
response.write varRs("market") & "(" & varRsMCount("marketCount") & ")<br>"
Wend
varRs.Close
That will list all the markets and the number of products in that market.