mysql中concat()这个函数看了下 感觉例子都说的不是很清楚
  想请教下。给个实例越简单越好

解决方案 »

  1.   

    MySQL的concat函数可以连接一个或者多个字符串
    EG:
    select concat('c','s','d','n');
    返回结果为:
    concat('c','s','d','n')
    csdnMySQL的concat函数在连接字符串的时候,只要其中一个是NULL,那么将返回NULL
    EG:
    select concat('c','s','d','n',null);返回结果为:
    concat('c','s','d','n',null)
    NULL
      

  2.   

    就是拼接字符串。
    CONCAT(str1,str2,...)Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:SELECT CONCAT(CAST(int_col AS CHAR), char_col);CONCAT() returns NULL if any argument is NULL.
      

  3.   

    如果是显示表中所有的列,并用逗号分开,可以用concat么,当然不是那种把所有列名都给写出来。