5

Mysql中concat_ws如果是空的,如何不被分隔符分开

 3 years ago
source link: http://www.hechunbo.com/index.php/archives/376.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Mysql中concat_ws如果是空的,如何不被分隔符分开

SELECT CONCAT_WS(",",IF(1>2,"1",""),"1","2","3")

输出为: ,1,2,3

如果不想要前面的,号,可以把改为null,表示不输出。

SELECT CONCAT_WS(",",IF(1>2,"1",NULL),"1","2","3")

输出为:1,2,3

creativecommons-cc.png
本文由 hcb 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK