zoukankan      html  css  js  c++  java
  • concat,concat_ws和group_concat函数的区别

    一、concat()函数

      1、定义:将多个字符串连接成一个字符串。

      2、使用语法:concat(str1,'-' str2,...)

        返回字符串参数不能为null,否则返回值为null。

      举例

    二、concat_ws()函数

      1、定义:将多个字符串连接成一个字符串,可以一次性指定分隔符-,要不然有10个参数写10个太麻烦了。

      2、使用语法:concat('-',str1, str2,...)

        返回字符串参数可以为空,但分隔符不能为null,否则返回值为null。

      举例

    三、group_concat()函数

      1、定义:参数是可以直接使用order by排序的,适合多表查询,把对应表和这个表相关的组成一个组一条记录。

      2、使用语法:concat(str1, str2 order by str2 asc separator '~')

      举例

  • 相关阅读:
    harbor docker
    dns服务器
    k8s
    frps
    svn 搭建
    phpstrom 破解 转载https://www.jianshu.com/p/e71361b3bfee
    公开课
    k8s
    rsync各种备份
    定时任务
  • 原文地址:https://www.cnblogs.com/thcy1314/p/10838111.html
Copyright © 2011-2022 走看看