Friday, 19 July 2019

How to use GROUP BY to concatenate strings in MySQL?

SELECT id, GROUP_CONCAT(string SEPARATOR ' ') FROM table GROUP BY id;
From the link above, GROUP_CONCAT: This function returns a string result with the concatenated non-NULL values from a group. It returns NULL if there are no non-NULL values.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive