第一种:
MySQL自带语法Concat(string1,string2,string3…),此处是直接把string1和string2等等的字符串拼接起来(无缝拼接哦)
说明:此方法在拼接的时候如果有一个值为...NULL,则返回NULL
select concat("aaa","bbbb","ccccc") as str
select concat("aaa","bbbb",null) as str...第二种:
第二种也是mysql自带语法CONCAT_WS(separator,string1,string2,…),但是可以多个字符串用指定的字符串进行拼接(带缝拼接哦)
说明:string1,string2...代表的是字符串,而separator代表的是连接其他参数的分隔符,可以是符号,也可以是字符串。...select 1 as test1, CONCAT_WS("aaa",null,"cccc") as str union all
select 2 , CONCAT_WS("aaa","bbbb",null