I want to concatenate different record values, for example, I have the table below:
| id | value
| 1 | value1 |
| 2 | value2 |
| 3 | value3 |
To show the following result: value1, value2, value3
I'm using PHP + MySQL.
I want to concatenate different record values, for example, I have the table below:
| id | value
| 1 | value1 |
| 2 | value2 |
| 3 | value3 |
To show the following result: value1, value2, value3
I'm using PHP + MySQL.
Just use the GROUP_CONCAT
function. of MySQL.
SELECT GROUP_CONCAT(campo SEPARATOR ', ')
FROM tabela;