简体   繁体   中英

Limit in the number of aggregated characters after running GROUP_CONCAT in SQL

I am using GROUP_CONCAT in my query to collect some IDs. Imagine I have two columns as follow:

user_id
item

The code looks like this:

SELECT user_id, GROUP_CONCAT(item) AS all_items_by_user
FROM table
GROUP BY user_id

However, I noticed that the all_items_by_user column can accommodate up to a certain number of characters in each cell. This limit is around 1100 in my case, whereas I expect at least 10 times more. I wondered whether there is any way to increase this limit? Thank you.

This is controlled by group_concat_max_len , a system variable.

The documentation describes how to change the value and what it really means.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM