Skip to content

Instantly share code, notes, and snippets.

@jsntn jsntn/MySQL_concat_ws.sql Secret

Created May 8, 2014
Embed
What would you like to do?
-- 连接后以逗号分隔
mysql> select concat_ws(',','11','22','33');
+-------------------------------+
| concat_ws(',','11','22','33') |
+-------------------------------+
| 11,22,33 |
+-------------------------------+
1 row in set (0.00 sec)
-- 和MySQL中concat函数不同的是, concat_ws函数在执行的时候,不会因为 NULL 值而返回 NULL
mysql> select concat_ws(',','11','22',NULL);
+-------------------------------+
| concat_ws(',','11','22',NULL) |
+-------------------------------+
| 11,22 |
+-------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.