MySQL and GROUP_CONCAT() maximum length

前端 未结 7 890
难免孤独
难免孤独 2020-11-22 15:24

I\'m using GROUP_CONCAT() in a MySQL query to convert multiple rows into a single string. However, the maximum length of the result of this function is 10

7条回答
  •  名媛妹妹
    2020-11-22 15:46

    SET SESSION group_concat_max_len = 1000000;
    

    is a temporary, session-scope, setting. It only applies to the current session You should use it like this.

    SET SESSION group_concat_max_len = 1000000;
    select group_concat(column) from table group by column
    

    You can do this even in sharing hosting, but when you use an other session, you need to repeat the SET SESSION command.

提交回复
热议问题