I want to convert selected values into a comma separated string in MySQL. My initial code is as follows:
SELECT id FROM table_level where parent_id=4;
First to set group_concat_max_len, otherwise it will not give you all the result:
set group_concat_max_len
SET GLOBAL group_concat_max_len = 999999; SELECT GROUP_CONCAT(id) FROM table_level where parent_id=4 group by parent_id;