CONCAT_WS()
CONCAT_WS(separator
,str1
,str2
, ...)
Works in the same way as CONCAT
, except it inserts a separator
between the items being concatenated. If the separator is NULL
the result will be NULL
, but NULL
values can be used as other arguments,
which will then be skipped. This code returns the string
“Truman,Harry,S”:
SELECT CONCAT_WS(',' 'Truman', 'Harry', 'S');