MySQL and GROUP_CONCAT() maximum length

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 … Read more

Can I concatenate multiple MySQL rows into one field?

You can use GROUP_CONCAT: SELECT person_id, GROUP_CONCAT(hobbies SEPARATOR ‘, ‘) FROM peoples_hobbies GROUP BY person_id; As Ludwig stated in his comment, you can add the DISTINCT operator to avoid duplicates: SELECT person_id, GROUP_CONCAT(DISTINCT hobbies SEPARATOR ‘, ‘) FROM peoples_hobbies GROUP BY person_id; As Jan stated in their comment, you can also sort the values before … Read more

How to concatenate text from multiple rows into a single text string in SQL Server

If you are on SQL Server 2017 or Azure, see Mathieu Renda answer. I had a similar issue when I was trying to join two tables with one-to-many relationships. In SQL 2005 I found that XML PATH method can handle the concatenation of the rows very easily. If there is a table called STUDENTS SubjectID … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)