Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help with design

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2003-09-12 : 03:24:46

I am attempting to design a db structure as follows

TblZones
zoneID(identity),userID,websiteName,URL,description,categoryID

Sample Data:
1,1,sqlteam,www.sqlteam.com, best sql site on the net!,10
2,1,asp.net,www.asp.net,great asp.net resource site!,10

The problem I am having is with the categoryID. So far what I have done is just insert the correct categoryID when a new row is inserted into the "tblZones"

I have a "tblCategories" table as such

categoryID, category
1,Arts
2,Games
etc.

So far everything is fine, but these categories so far are actually just sub-categories. I need to somehow relate this to a parent category. Whats the best or way to accomplish this?

Should I add a "parentCategoryID" to the "tblCategories" ?
Should I have a new table altogether featuring jsut "categoryID" and "parentCategoryID".

Or should I altogether do it another way?

I need to have a parentID for the categoryID. Where should I put this data? The reason I need to do this is because I need to run select statements according to the parent ID value.


Thanks for any insight

mike123

dsdeming

479 Posts

Posted - 2003-09-12 : 08:19:52
quote:
Should I add a "parentCategoryID" to the "tblCategories" ?



Yes. I would treat this the same way you would an employee table that contains managers and their employees.

Dennis
Go to Top of Page
   

- Advertisement -