Tor-Erik,

If 'I' was a language syntax interpreter, i'd see
 "where not field like pattern" as
 where (not(field) like pattern
and
 "where field not like pattern" as
 where (field !like pattern)

notice that not(field) probably returns 'False' so your first query is:
 where False like pattern
with, of course, a empty result set....

Use brackets anyhow because
 "where not (field like pattern)"
makes sense!

rene


----- Original Message -----
From: "Tor-Erik Hagen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Tor-Erik Hagen" <[EMAIL PROTECTED]>
Sent: Sunday, January 28, 2001 12:56 AM
Subject: Bug ?? combining NOT and like in where clause


> Tested on the following versions of mysql: 3.22.32, 3.23.31 on Linux
>
> Description:
> "where not field like pattern" gives empty set, while
> "where field not like pattern" return what i expect
>
> How-To-Repeat:
> create table testtabell(test varchar(10));
> insert into testtabell values('test.com')
> insert into testtabell values('test.no')
> insert into testtabell values('test2.com')
> insert into testtabell values('test2.no')
>
> select * from testtabell where not test like '%.no';
> This returns an empty set
>
> select * from testtabell where test not like '%.no';
> This one returns:
> +-----------+
> | test      |
> +-----------+
> | test.com  |
> | test2.com |
> +-----------+
> 2 rows in set (0.00 sec)
>
> That is right.
>
> I don't know if the first one is legal syntax, but it should
> then return an parse error on the sql, not an empty set.
>
>
> MySQL support: none
> Severity:      non-critical
> Priority:      low
> Category:      mysql
> Class:         sw-bug
> Release:       mysql-3.23.31 (Source distribution)
>
> Environment:
>         <machine, os, target, libraries (multiple lines)>
> System: Linux zalo 2.2.16 #73 Fri Jun 16 18:48:22 PDT 2000 i586 unknown
> Architecture: i586
>
> Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc
/usr/bin/cc
> GCC: Reading specs from
/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
> Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
> Configure command: ./configure  --without-bench
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to