-
-
Save jsntn/993977ebfb7f524155ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 连接后以逗号分隔 | |
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