Jump to: navigation, search

Mysql CONCAT WS

From w3cyberlearnings

Contents

MySQL CONCAT_WS Function

This function concatenates all arguments with a separator and the first argument is the separator.

Syntax CONCAT_WS

  • Separator: a separator of a given word
  • word1: word input
  • word2: second word input
CONCAT_WS(Separator,word1,word2,...);

Example 1

mysql> SELECT CONCAT_WS(':','John','Goes','To','Johnny','House');
+----------------------------------------------------+
| CONCAT_WS(':','John','Goes','To','Johnny','House') |
+----------------------------------------------------+
| John:Goes:To:Johnny:House                          |
+----------------------------------------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT CONCAT_WS('^','let','a','b');
+------------------------------+
| CONCAT_WS('^','let','a','b') |
+------------------------------+
| let^a^b                      |
+------------------------------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References