Updated on 2023-03-06 GMT+08:00

Incorrect GROUP_CONCAT Results

Scenario

When the GROUP_CONCAT() function is used in an SQL statement, the result does not meet expectations.

Possible Causes

The GROUP_CONCAT() function returned a string result consisting of concatenated values in the group. However, the group_concat_max_len parameter limited the result length of this function.

Example:

Solution

Change the value of group_concat_max_len to adapt to the result length of the GROUP_CONCAT() function.