CONCAT_WS(separator,str1,str2,...)
The full form of CONCAT_WS is concatenate with Separator which is a special form of CONCAT(). The first argument in CONCAT_WS is used as a separator for concatenate all other arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.
mysql> select concat_ws(' ','Hello','World');
+--------------------------------+
| concat_ws(' ','Hello','World') |
+--------------------------------+
| Hello World |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select concat_ws(' ','Hello','World.','How','are','you');
+---------------------------------------------------+
| concat_ws(' ','Hello','World.','How','are','you') |
+---------------------------------------------------+
| Hello World. How are you |
+---------------------------------------------------+
1 row in set (0.00 sec)
mysql> select concat_ws('-','My','SQL');
+---------------------------+
| concat_ws('-','My','SQL') |
+---------------------------+
| My-SQL |
+---------------------------+
1 row in set (0.00 sec)
0 Comment(s)