开发者

Which structure in MySQL db for a cat sub sub situation

开发者 https://www.devze.com 2023-03-31 12:01 出处:网络
For one of my new projects I have to create a category page with head category, sub category and sub sub categorie. for example;

For one of my new projects I have to create a category page with head category, sub category and sub sub categorie. for example;

  • Internet
  • Internet > Developing
  • internet > Developing > Mobile apps

In this categories you can find websites about these things. I have to give every website the id of the category? what do I have to do if I want to show all these websites开发者_开发技巧 related to 'Internet > developing' at 'Internet' (the head category?)

Thanks in advice.

Regards, Nicky


This is typical situation where the Nested Sets model is very useful


In dev.mysql there was a guide to work with hierachical daat :(

I haven't try this but I just got it http://explainextended.com/2009/03/17/hierarchical-queries-in-mysql/

Also, if you look for "hierachical data" mysql, you will get a lot of options to do what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号