MySQL and GROUP_CONCAT() maximum length

前端 未结 7 987
难免孤独
难免孤独 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:42

    The correct syntax is mysql> SET @@global.group_concat_max_len = integer;
    If you do not have the privileges to do this on the server where your database resides then use a query like:
    mySQL="SET @@session.group_concat_max_len = 10000;"or a different value.
    Next line:
    SET objRS = objConn.Execute(mySQL)  your variables may be different.
    then
    mySQL="SELECT GROUP_CONCAT(......);" etc
    I use the last version since I do not have the privileges to change the default value of 1024 globally (using cPanel).
    Hope this helps.

提交回复
热议问题