Print Page | Close Window

Database advise

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=18480
Printed Date: 28 March 2026 at 7:50pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Database advise
Posted By: urko
Subject: Database advise
Date Posted: 22 February 2006 at 9:25am
Hi

Im making sort of a directory on my site.

Now I would need some advise how to build my DB ( access + asp ) for  categories / subcategories.

Momentarily I have 2 tables.
First one
TBLPRODUCTS is for products
second
TBLCATS include Categories + Sub Cateogries.

On my page everything works well, expect when I want to count records
(#) next to cateogries I always get 0 or it shows all:
expample:
Category1 (4)
.....Subcateogry (4)
Category2 (4)
.....Subcateogry (4)

...and I only have 4 products in my product table.

Can any1 give me some advise on how to make my DB (categories / subcategories)  so that users will be to see next to categories ( #) and when they click on certian cateogry it will show
Subcategories with correct (#).

I hope u know what I mean....sorry for my poor english

Thanks,Wink

 


-------------
Urko



Replies:
Posted By: michael
Date Posted: 22 February 2006 at 3:29pm
You need to do a recursive query counting subcategories, adding those up to the parent cateogory. If you do that on the fly for every display of that page, performance will be a drag. I would when adding a directory entry, put a counter on the category itself. Then you just need to add up the subcategories to the parents.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net