Skip to content
Advertisement

How can I join these rows together with commas as a column in my select?

I have the following query:

The first line of the select will not work, I know this, but I’m just trying to demonstrate what it is I want from this query,

What I’m trying to achieve, is to have another column in my select called additional_departments which would be the department field from my additionaldepartments table, joined together in a string separated with commas.

Advertisement

Answer

What you want is GROUP_CONCAT():

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement