我想获取 CategoryID(1) ;如果其子类别(2)在内容表中。
我的意思是:从 contenttable 中获取 categoryid (2);在 categorytable 中找到它的 parentid(1);并选择顶级类别行(categoryid:1) - 所以我无法选择内容的顶级类别行,我该怎么做?
分类表:
CategoryID , ParentID
    1            0
    2            1
内容表:
  _id, CategoryID
  ...       2 
代码:
   SELECT DISTINCT contenttable.CategoryID, categorytable.CategoryID FROM categorytable 
                    INNER JOIN contenttable 
                    ON categorytable.CategoryID = contenttable.CategoryID