I get the same thing on our system (MySQL 4.0.15 running on Linux Mandrake
9.1).

According to the manual, section 1.8.4:

"MySQL Server understands the || and && operators to mean logical OR and
AND, as in the C programming language. In MySQL Server, || and OR are
synonyms, as are && and AND. Because of this nice syntax, MySQL Server
doesn't support the standard SQL-99 || operator for string concatenation;
use CONCAT() instead. Because CONCAT() takes any number of arguments, it's
easy to convert use of the || operator to MySQL Server."

If you rewrite your query as follows, you should get the result you wanted:

select concat('This is a ', 'test string');

Rhino

----- Original Message ----- 
From: "Hassan Shaikh" <[EMAIL PROTECTED]>
To: "MySQL (General List)" <[EMAIL PROTECTED]>
Sent: Monday, February 23, 2004 7:58 AM
Subject: Concat. operator ||


> Hi All,
>
> I am running MySQL in ANSI standard mode. However the following
> statement is giving unexpected result. Am I missing something?
>
>     mysql> select 'This is a' || ' test string';
>     +-------------------------------+
>     | 'This is a' || ' test string' |
>     +-------------------------------+
>     |                             0 |
>     +-------------------------------+
>     1 row in set (0.00 sec)
>
> Here's a part of my my.ini, indicating that I am in ANSI mode.
>
> # The MySQL server
> [mysqld]
> port=3306
> #socket=MySQL
> skip-locking
> set-variable    = sql-mode=ansi
> set-variable    = key_buffer=32M
> set-variable    = max_allowed_packet=1M
> set-variable    = table_cache=32
> set-variable    = net_buffer_length=8K
> set-variable    = sort_buffer=1M
> set-variable    = record_buffer=512K
> set-variable    = myisam_sort_buffer_size=4M
> set-variable    = thread_cache=8
> # Try number of CPU's*2 for thread_concurrency
> set-variable    = thread_concurrency=8
> log-bin
> server-id    = 1
>
> Thanks.
>
>
> Hassan
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to