Mysql – In MySQL, is it possible to get more than 1024 characters back from GROUP_CONCAT

mysql

I have a query which returns the count of a status that needs some very complex work to calculate. The user wants to drill down into that list, and I thought the easiest way would be to get the ids using GROUP_CONCAT.

Unfortunately, the result from GROUP_CONCAT is being truncated to 1024 (?!) characters.

Is it possible to get more than 1024 characters, or am I going about this the wrong way?

Best Solution

You need to set group_concat_max_len to a higher value. This can be done on a session or global level. The following query sets the max length to 10,000 for the rest of the queries in that session:

SET SESSION group_concat_max_len = 10000;

What you're running into is the group_concat default max of 1024.

Related Question