On Mon, 21 Mar 2011 11:51:27 +0100
Johan De Taeye <johan.de.ta...@gmail.com> wrote:

> insert into lookup (name) values ('AAA');
> 
> select * from lookup where name like 'A%';
> => 1 record returned.   OK
> 
> select * from lookup where name like 'A' || '%';
> => returns nothing.   INCORRECT!

The query is incorrect. The OR switch does not act as an ellipsis, and does not 
apply both values to the LIKE. You need to write LIKE X OR LIKE Y, as

select * from lookup where name like 'A' || or name like '%';

> select * from lookup where name like ('A' || '%');
> => same as previous and returns nothing.   INCORRECT!

Again correct, you tried to match `name` against boolean TRUE (the evaluation 
of you expression).

> 
> Best regards,
> 
> Johan


-- 
Simcha Younger <sim...@syounger.com>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to