Reputation: 113
Let's say i have entry's like this.
Projects Persons Project1 Person1 Project1 Person2 Project1 Person3 Project2 Person1
And i need an output like this:
Project1 Person1,Preson2,Person3 Project2 Person1
How can i do this using mySql?
Upvotes: 0
Views: 38
Reputation: 497
try this:
SELECT Projects,
GROUP_CONCAT(DISTINCT Persons
ORDER BY Persons SEPARATOR ',')
FROM <your_table_name>
GROUP BY Projects;
Upvotes: 1