2

假设我有一个这样的 article_category 树:

GrandPa Cate
|______ Parent Cate 1 (article 1, article2)
|______ Parent Cate 2
|______|_____ Child Cate 1 (article 3, article 4)
|______|_____ Child Cate 2 (article 5)

表:

类别

id    | parent_id | title
----------------------------------------
1     | null      | GrandPa Cate
----------------------------------------
2     | 1         | Parent Cate 1
----------------------------------------
3     | 1         | Parent Cate 2
----------------------------------------
4     | 3         | Child Cate 1
----------------------------------------
5     | 3         | Child Cate 2
----------------------------------------

文章

id    | cate_id   | title
----------------------------------------
1     | 2         | article 1
----------------------------------------
2     | 2         | article 2
----------------------------------------
3     | 4         | article 3
----------------------------------------
4     | 4         | article 4
----------------------------------------
5     | 5         | article 5
----------------------------------------

选择Granpa Cate如何获得全部5篇文章?

4

0 回答 0