Patrick
Patrick

Reputation: 115

get multiple data from column in one row

In the column tutor, tutors can be duplicated but project numbers are unique. I need to get all tutors and all the project numbers they have.

for example I have:

column tutor                column projects
Steve                         1
Theo                          2
John                          3
Steve                         4

And the result I need is:

Steve 1, 4
Theo 2
John 2

Upvotes: 0

Views: 286

Answers (1)

Jocelyn
Jocelyn

Reputation: 11393

SELECT tutor, GROUP_CONCAT(projects SEPARATOR ',') AS projects_list
FROM your_table
GROUP BY tutor

Documentation: GROUP_CONCAT

Upvotes: 3

Related Questions