B
B
bozilly2015-08-06 14:40:40
MySQL
bozilly, 2015-08-06 14:40:40

How does GROUP_CONCAT work?

Let's say there are 2 tables:
users
52c69ee4482742d0bb96dbf3cf7b5d27.png
pets
a26c2139af47441dbf75a635c53dc422.png
I make a query:

select users.id_user,users.name, GROUP_CONCAT(pets.pet SEPARATOR ', ') AS pets FROM users LEFT JOIN pets ON users.id_user=pets.id_user;

And I get this rubbish:
2b407fa4b41a4e91a292c5078ca436aa.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentine, 2015-08-06
@bozilly

This function works together with grouping, you have the wrong request.
See documentation: https://dev.mysql.com/doc/refman/5.0/en/group-by-f...
UPD: maybe this answer on SO will help you: stackoverflow.com/questions/4455958/mysql-group -co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question