A
A
Alexey2015-12-10 14:50:45
PHP
Alexey, 2015-12-10 14:50:45

How to combine fields into one?

Hello! I select several records from the database (the number is not known) that have different `name` fields.
Is it possible to get all the `name` fields in one, for example, separated by commas?
type CONCAT(), but CONCAT connects fields that are in the same record.
Here is an example of what I want:1e2fdcfeb38844a99e111ffd04ddcbe0.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romy4, 2015-12-10
@dzheka3d

select 1,id,concat_ws(',',name) name from xxx group_by 1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question