Hi,
Aggregate function GROUP_CONCAT in MySQL
These are values from my table of db MySQL 5.5.62 version
31A 31C 32B 32D 52G
I use the MySQL GROUP_CONCAT() function is an aggregate function that concatenates strings from a group into a single string with various options for this return '31A', '31C', '32B', '32D', '52G'
This is the query
SELECT
GROUP_CONCAT( DISTINCT CONCAT( '''', xCOD ) ORDER BY xCOD ASC SEPARATOR ''', ' ) AS x_group
FROM `xtbl`
ORDER BY xCod ASC;
| x_group |
+----------------------------------+
| '31A', '31C', '32B', '32D', '52G |
+----------------------------------+
1 row in set (2.16 sec)
But on the return the last element of MySQL `GROUP_CONCAT()` function don't have the single quote '52G
How to do resolve this?
Thanks in advance for any help.