Select query with junction table to one row?

Here are my tables and their columns:

scientificStudies
studyID
title
summary

topics
topicID
topic

scientificStudyTopics
studyID
topicID

Is it possible in mySQL to return a row for each study, with one of the columns containing the linked topics separated by a comma? The following row is an example of what I’m trying to put together. The topics of “candida, dandruff, dermatitis, fungus, scalp, seborrheic-dermatitis” are individual rows in the topics table, linked using the scientificStudyTopics junction table. I can successfully join the three tables, for example, to find studies that are not linked with a topic. But now I’m trying to include each of the assigned topics in one column. I hope this makes sense.

Thanks!

studyID = 110

title = “Tea tree oil attenuates experimental contact dermatitis”

summary = "“It is suggested that the in vivo effect of tea tree oil ointment in the therapy of fungal infections of the skin and mucous membranes as well as in the treatment of dandruff, a mild form of seborrheic dermatitis, may be at least partly due to an antifungal activity of tea tree oil.”

topics = “candida, dandruff, dermatitis, fungus, scalp, seborrheic-dermatitis”

https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_group-concat

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.