MySQL Forums
Forum List  »  Partitioning

Need help with well partitioned tables
Posted by: Felix Boes
Date: November 10, 2008 01:30AM

First of all: sorry for my bad english.
I hope you can help me with the following problem.

I want to save a hierarchy of categories. For example:

n) = ID of the Categorie

1) All Categories
2) 1) -> Science
3) 1) -> 2) -> Maths
4) 1) -> 2) -> Physics
5) 1) -> 2) -> 4) -> Classical Physics
6) 1) -> Religion
7) 1) -> 6) Asian Religion
8) 1) -> 6) -> 7) Bhuddism
...

I dont know yet how much subcategories I will create. I want to search for a categorie and want to find all of its subcategories.
I already have a solution, but want to know if someone knows a smarter way to solve the problem.
My solution:
Create table (
id int,
name varchar(n)
finder text
)

the finder string looks like that: _["id of catogorie above"_["id of categorie above"_[...]]id_
That make a simple search possible:
SELECT id, name FROM table WHERE finder like %_"seach id"_%;

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help with well partitioned tables
3142
November 10, 2008 01:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.