Using CONCAT_WS() is simple and straight forward. We have to
specify the separator in the form of char, nchar, varchar or nchar as the first
argument. Then we can pass on the variables to concatenate in the subsequent
arguments. This function will ignore NULL.
CONCAT_WS indicates concatenate with separator
Syntax
CONCAT_WS (separator, argument1, argument2 [, argumentN]...)
|
See the example
SELECT CONCAT_WS(',','Bagesh', 'Kumar', 'Singh') AS Full_Name;
SELECT CONCAT_WS('-','Bagesh', 'Kumar', 'Singh') AS Full_Name;
SELECT CONCAT_WS(',','Bagesh', 'Kumar', null,null,'Singh') AS Full_Name;
|