请帮助!我需要获取与'42'的cat_id相关的entry_id,然后找到附加到我们刚刚过滤的entry_id的所有cat_id。然后我需要获取cat_id_id的cat_group_id。请参阅下表的屏幕截图:
修改
E.g。 entry_id 92分配了cat_id 42。但它也有48&这是我需要输出的这些数字。但是只有当entry_id在cat_id 42中时
答案 0 :(得分:1)
我不太了解你想要的是什么,是吗?
select
group_id
from
exp_categories
inner join
exp_category_posts
on exp_category_posts.cat_id = exp_categories.cat_id
where
entry_id in (select entry_id from exp_category_posts where cat_id = 42)
;
注意:我没有创建表来测试它,但我认为查询没问题