What am I doing wrong with this query? The results will sometimes return the same row.
studyTopics.studyID = studies.studyID
testimonialTopics.topicID = studyTopics.topicID
topics.topicID = studyTopics.topicID
testimonials.testimonialID = testimonialTopics.testimonialID
testimonials.testimonialID = '4353'
I’m sorry this query caused some confusion. Each testimonial is assigned multiple topics. Each scientific study is assigned multiple topics. I’m just trying to see a list of scientific studies that should be shown for a given testimonial. So if the testimonial is tagged with the topic of acne, and if there are 3 scientific studies that are also tagged with the topic of acne, then the results should show three rows. Currently the results will sometimes return the same scientific study more than once.
, GROUP_CONCAT(topics.topic) AS topics
ON topics.topicID = testimonialTopics.topicID
ON studyTopics.topicID = topics.topicID
ON studies.studyID = studyTopics.studyID
WHERE testimonialTopics.testimonialID = 4353