在MySQL中,实现字符串拼接主要有以下3种函数:
- concat(x,y,…)
- concat_ws(分隔符,x,y,…)
- group_concat(distinct xxx order by asd/desc yyy separator ‘分隔符’)
一、concat函数
concat()函数用于将多个字符串连接成一个字符串
格式:concat(str1,str2,…)
– mysql concat() –
SELECT CONCAT('I','love','somebody'); # Ilovesomebody
SELECT CONCAT('I','NULL,'somebody'); # NULL
SELECT CONCAT(14.4