mySQL query for selecting children

前端 未结 7 914
失恋的感觉
失恋的感觉 2020-12-20 05:59

I am not sure if this is possible in mySQL. Here are my tables:-

Categories table:

  • id
  • name
  • parent_id (which points to Categories.id)<
7条回答
  •  囚心锁ツ
    2020-12-20 06:40

    One way is to maintain a table that contains the ancestor to descendant relationships. You can query this particular table and get the list of all dependents.

提交回复
热议问题