SQL字符串连接函数

concat

将多行数据查询后当做一行显示

 

字符串连接函数 concat(str1,str2..)函数 直接连接

 

group_concat(str1,str2..)函数 使用逗号做为分隔符

 

group_concat(id,' ',username,' ',password);用空格隔绝数据

2 admin 123456

 

concat_ws(sep,str1,str2..)函数 使用第一个参数做为分隔符

select concat_ws('#',banji,grade) from student;

 

concat的使用限制

当concat后面连接的字符有一个是空时,整个显示为空

 

猜你喜欢

转载自blog.csdn.net/u012991692/article/details/82944550