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 1024
characters.
I'm very well aware that I can change the param
group_concat_max_len
to increase this limit:SET SESSION group_concat_max_len = 1000000;
However, on the server I'm using, I can't change any param. Not by using the preceding query and not by editing any configuration file.
So my question is: Is there any other way to get the output of a multiple row query into a single string?
Answers
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.
Include this setting in xampp my.ini configuration file:
[mysqld] group_concat_max_len = 1000000
Then restart xampp mysql
The correct syntax is mysql>
If you do not have the privileges to do this on the server where your database resides then use a query like:
mySQL=
Next line:
then
I use the last version since I do not have the privileges to change the default value of 1024 globally (using cPanel).
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(......);"
etcI use the last version since I do not have the privileges to change the default value of 1024 globally (using cPanel).
0 comments:
Post a Comment