Given this query (many thanks to RolandoMySQLDBA from question Select records that do not have associations outside a certain list), how do I add other fields from other tables into my result?
SELECT desired_categories.* FROM ( SELECT nid, title, COUNT(1) AS all_categories FROM node GROUP BY nid ) AS A INNER JOIN ( SELECT nid, COUNT(1) AS good_categories FROM node INNER JOIN field_data_dir_phys_category AS category ON node.nid = category.entity_id WHERE category.dir_phys_category_tid IN (498,499,500) GROUP BY nid ) AS B USING (nid) INNER JOIN ( SELECT DISTINCT nid, title FROM node ) AS desired_categories USING (nid) WHERE all_categories = good_categories;
I have about 5 fields from 5 other tables I need access to. All tables use the node id
nid to indicate their relationship. I suspect it's possible to simply add a join in for each table but I haven't had any luck yet.