I have searched unsuccessfully for a satisfactory explanation on the difference between
GROUP_CONCAT()
and CONCAT_WS()
.GROUP_CONCAT
is used when you want to have non-NULL values from different column rows in a single row. For this you need to have GROUP BY to work.CONCAT_WS
is to join two or more strings.
Example
GROUP_CONCAT(CONCAT_WS(' ', firstname, lastname) ORDER BY id ASC SEPARATOR ',');
Outputs something like,
John Doe,Blah Blah,Tom Cruise,Lorem Ipsum
0 Comments