Notice the nested subqueries. I know there’s a better way to make this happen with a JOIN. I just don’t have the expertise to figure it out.
SELECT DISTINCT pm.post_id
FROM wp_3_postmeta pm
WHERE pm.meta_key LIKE 'member_categories_%_member_categories_name'
AND pm.meta_value IN(
SELECT tt.term_taxonomy_id
FROM wp_3_term_taxonomy tt
WHERE tt.parent IN(
SELECT tt.term_taxonomy_id
FROM wp_3_term_taxonomy tt
WHERE tt.parent = 33)
OR tt.parent = 33
);
Thanks for your help!
This should do the trick for you