Mega Code Archive

 
Categories / MySQL / String
 

CONCAT_WS() function allows you to define a separator as one of the arguments in the function

mysql> CONCAT_WS(<separator>, <string1>, <string2> [{, <string>}...]) mysql> mysql> SELECT CONCAT_WS(' ', 'cats', 'and', 'dogs'); +---------------------------------------+ | CONCAT_WS(' ', 'cats', 'and', 'dogs') | +---------------------------------------+ | cats and dogs                         | +---------------------------------------+ 1 row in set (0.00 sec) mysql>