|
|
> Unfortunately, I've never done a "count" in a database. What's the basic
> concept behind that? I use MS SQL & asp.
Well, when a transaction for a purchase of a product is completed, I'd do a
DB call to update a table that tracks units sold. It could be as simple as:
table: sales count
productID | productCategory | unitsSold
001 | cat23 | 24
So, then product 001 is sold, query the 'sales count' table for that item,
add one to the unitsSold value, then update the table.
THEN, query the same table using a WHERE statement to pull up the top 10
products listed in this table sorted by unitsSold (in descending order) that
have the same productCateogory. Using a JOIN statement, you can then get the
product details from the PRODUCT table and then list these as "other popular
items in this category" and display that to the end-user.
That's just one way to do it. I'm sure you could do this a number of ways.
-Darrel
|
|