Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • CONCAT_WS function in MySQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 245
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: