【MySQL】字符串连接CONCAT_WS()

xixuefeng MySQL, MySQL-DEV 2018-02-18 20:32:23 775 次浏览 【MySQL】字符串连接CONCAT_WS()已关闭评论

MySLQ关于字符串连接,首先想到的是CONCAT(str1,str2,str3…),这个函数主要功能就是将所有参数连接在一起,如果在拼接字符串的时候我想用逗号隔开,那么用CONCAT就非常不方便了。

CONCAT_WS(separator,str1,str2,…),解决了上述问题

参数separator表示分隔符,str1,str2代表字符串,需要注意的是跟CONCAT一样,如果字符串中包含null,那么返回的依然是null

 

回顶部