3 messages in com.mysql.lists.bugsRE: NOT LIKE| From | Sent On | Attachments |
|---|---|---|
| Eric B. Schorvitz, Ph.D. | 14 Dec 2001 04:48 | |
| Jani Tolonen | 14 Dec 2001 06:41 | |
| Jani Tolonen | 14 Dec 2001 07:04 |
| Subject: | RE: NOT LIKE![]() |
|---|---|
| From: | Jani Tolonen (ja...@mysql.com) |
| Date: | 12/14/2001 06:41:00 AM |
| List: | com.mysql.lists.bugs |
Hi Eric,
Eric B. Schorvitz, Ph.D. writes:
I am running version 3.23.39
In the manual it states:
expr NOT LIKE pat [ESCAPE 'escape char'] Same as NOT (expr LIKE pat [ESCAPE 'escape char'])
I find this to be untrue.
(expr NOT LIKE pat) does not give the desired results while NOT (expr LIKE pat) does.
I could not find any other bug reports related to this topic. Does anyone know if this bug has been reported and fixed in a later version?
I think there is a problem in your SQL...
How-To-Repeat: 1) Set up a couple rows in a database table 2) Do: SELECT * FROM table_name WHERE expr1 LIKE pat1 AND expr2 NOT LIKE pat2 3) Then Do: SELECT * FROM table_name WHERE expr1 LIKE pat1 AND NOT expr2 LIKE pat2
You will see that line 2 will treat expr2 NOT LIKE pat2 as expr2 LIKE pat2 (i.e. it will ignore the NOT)
'expr not like pat' is same as 'not (expr like pat)'.
But please note that the line where you have '3)' is NOT the same; there you have 'not expr like pat', which is different! The latter one will evaluate 'not <string>', which will take a numeric value of <string>, which is zero, which will result in 1, as 'not 0' is true. So in the 3) above you are testing whether "1 like pat2".
If this doesn't help, please send an exact example of the problem, with exact CREATE, INSERT and SELECT statements.
Thanks,
Eric
Regards,
- Jani
For technical support contracts, visit https://order.mysql.com/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Jani Tolonen <ja...@mysql.com> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer /_/ /_/\_, /___/\___\_\___/ Helsinki, Finland <___/ www.mysql.com




