List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 21 2004 12:02am
Subject:Re: String Concatenation Operator?
View as plain text  
At 16:45 -0600 3/20/04, Matt W wrote:
>Hi Jim,
>Unfortunately you do have to use the CONCAT() function to make sure it
>works on all MySQL installations.  The operator used in other DBs, and
>which can be used in MySQL when running in ANSI mode, is ||, not +:
>SELECT firstname || ' ' || lastname AS fullname
>  FROM customers
>But if MySQL isn't in ANSI mode (specifically, the PIPES_AS_CONCAT
>part), which is typical since it's not enabled by default, || is logical
>OR. :-(

You can also use simple proximity as a concatenation "operator":

mysql> select 'hello,' ' world';
| hello,       |
| hello, world |

This does not depend on the server SQL mode.

Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA

MySQL Users Conference: April 14-16, 2004
String Concatenation Operator?Jim McAtee18 Mar
  • Re: String Concatenation Operator?Matt W20 Mar
    • Re: String Concatenation Operator?Paul DuBois21 Mar
RE: String Concatenation Operator?Andrew Braithwaite18 Mar