I am using Drupal 7. I have a content type "Public Resource" that uses a hierarchical vocabulary called "Resource Topics" that has up to 3 levels (parent->child->child of child).
We have about 1000 Public Resources that are created. It has come to my attention that when our staff has been creating Public Resources nodes and choosing the "Resource Topics" terms if they choose a child they don't always choose the parent of that child.
This creates data inconsistency and I am trying to find out a way of identifying what "Public Resources" fit into this category.
I don't know if there is a way of setting up a view in order to do this but I wasn't able to figure this out.
I am also trying to write a database query that would identify these "Public Resource" nodes but since I can't pass in a field value to a subquery. This query returns all topics that are associated with a public resource and has parent data and parent term is associated with the public resource node.
SELECT node.nid, taxonomy_term_data.tid, taxh1.parent
FROM node
LEFT JOIN taxonomy_index ON taxonomy_index.nid=node.nid
LEFT JOIN taxonomy_term_data ON taxonomy_term_data.tid = taxonomy_index.tid
LEFT JOIN taxonomy_vocabulary ON taxonomy_vocabulary.vid = taxonomy_term_data.vid
LEFT JOIN taxonomy_term_hierarchy AS taxth1 ON taxth1.tid = taxonomy_term_data.tid
WHERE node.type = "public_resource"
AND taxonomy_vocabulary.name= "Resource Topic"
AND taxth1.parent NOT IN (
SELECT taxonomy_term_data.tid
FROM node
LEFT JOIN taxonomy_index ON taxonomy_index.nid=node.nid
LEFT JOIN taxonomy_term_data ON taxonomy_term_data.tid = taxonomy_index.tid
LEFT JOIN taxonomy_vocabulary ON taxonomy_vocabulary.vid = taxonomy_term_data.vid
LEFT JOIN taxonomy_term_hierarchy ON taxonomy_term_hierarchy.tid = taxonomy_term_data.tid
WHERE node.type = "public_resource" AND taxonomy_vocabulary.name = "Resource Topic" AND taxonomy_index.tid = taxth1.parent
)