Forums

ASP

This topic is locked

access database:display counted table

Posted 14 Jan 2003 04:56:29
1
has voted
14 Jan 2003 04:56:29 zoe z posted:
hi everyone...
this is what i want my database to do: count how many user that have registered for a certain product and display it in the system.so, everytime a user pick a certain product to register,the database automatically count him,and display,say "3 users registered for this product".and,can i limit how many users can register for a product?say,only 4 users can register for a product and when the 5th user try to register,he will be denied.i have 2 tables and they look like this:
tblRegister||Prod_ID|user_ID|date|timeand tblProduct||Prod_ID|prod_name|prod_desc|no_of_register
so,how can i possibly do this the right way?i use asp.
pls,can anybody help..


Replies

Replied 14 Jan 2003 13:18:18
14 Jan 2003 13:18:18 Lee Diggins replied:
Hi Zoe,

to count the items use this SQL:

SELECT COUNT(*) AS myCount
FROM my_table
WHERE (my_column >= put your value here)

When you have you value back on the page you can decide to display what you want, register if less than 4 or don't register if >= 4. Providing it's coded correctly the value should never be mor than 4.

On the register this product form, you need to increment the register value by 1.

Hope this helps

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic