mysql comma delimited result [ 572 views ]
Goal: select a quick comma delimited value for a column
The method is easy. In this example the result is a long string contains comma delimited list of the language names.
select GROUP_CONCAT(lng_name) as lngnames from languages;
the result something like this:
English,Afar,Abkhazian,Afrikaans,Amharic,Arabic,Assamese,Aymara,Azerbaijani,Bashkir ...
But the working buffer size is a weak point in this story. The correct way something like this:
SET SESSION group_concat_max_len = 1000000; select GROUP_CONCAT(lng_name) as lngnames from languages;
So the result is hopefully the full length string… Don’t forget to check!