Outdated Version

You are viewing an older version of this section. View current production version.

CONCAT_WS

CONCAT_WS stands for concatenation with separator. The first argument is a separator that is placed in between the remaining arguments when concatenating them together. If any of the expressions is NULL it is skipped in the concatenated output.

Syntax

CONCAT_WS(separator, expression, [ expression, [expression ...]])

Arguments

  • separator: A separator expression. This may be a column name, the result of another function, or a math operation.
  • expression: any set of expressions. This may be a column name, the result of another function, or a math operation.

Return Type

The concatenated string.

Examples

memsql> select concat_ws('a','1','2','3');
+----------------------------+
| concat_ws('a','1','2','3') |
+----------------------------+
| 1a2a3                      |
+----------------------------+

memsql> select concat_ws('a','1',NULL,'3');
+-----------------------------+
| concat_ws('a','1',NULL,'3') |
+-----------------------------+
| 1a3                         |
+-----------------------------+

Related Topics