In MySQL, we can use the CONCAT_WS() function to combine two or more strings with a delimiter. The syntax of this function is CONCAT_WS(Separator, String1,String2,…,StringN)
Here, the parameters of the CONCAT_WS function are the Separator and the string that needs to be connected. The separator is treated as a single character. string. Delimiters other than numeric values must be enclosed in quotes.
mysql> Select CONCAT_WS('.','www','tutorialspoint','com'); +---------------------------------------------+ | CONCAT_WS('.','www','tutorialspoint','com') | +---------------------------------------------+ | www.tutorialspoint.com | +---------------------------------------------+ 1 row in set (0.00 sec)
In the above example, we can see that the separator "." (i.e. dot) is inserted between the three strings that need to be concatenated (www, tutorialspoint and com) between.
The above is the detailed content of In MySQL, how to combine two or more strings with delimiter?. For more information, please follow other related articles on the PHP Chinese website!