Using two different junction tables in a single query

[quote=“busboy, post:3, topic:198047, full:true”]
Can you offer a tad bit more to go on?[/quote]

sure thing…

[quote]
I want to write a query that displays the
topicID, topic,
count of how many times that topic appears in studyTopics,
count of how many times that topic appears in testimonialTopics.[/quote]

SELECT topics.topicID , topics.topic , COALESCE(topic_studies.studies_count,0) AS studyTopics_count , COALESCE(topic_testimonials.testimonialID_count,0) AS testimonialTopics_count FROM topics LEFT OUTER JOIN ( SELECT topicID , COUNT(*) AS studies_count FROM studyTopics GROUP BY topicID ) AS topic_studies ON topic_studies.topicID = topics.topicID LEFT OUTER JOIN ( SELECT topicID , COUNT(*) AS testimonials_count FROM testimonialTopics GROUP BY topicID ) AS topic_testimonials ON topic_testimonials.topicID = topics.topicID