Hi, I posted this query to the list via the newsgroup mailing.database.mysql a few days ago but didn't receive any replies. If someone could respond and let me know whether or not I'm asking something that should be obvious or if this is just something that's not that common so know one knows the answer, I would really appreciate it. :-) Anyway, on with my question: I have MySQL v3.22.32 running on Linux (RH 7.0). I'm noticing what seems to me to be strange behavior of LIKE statements when strings containing escape characters are involved. In the odd rare case that I have a value in a field that actually contains the backslash character in it, it seems that the behavior of LIKE changes, and to find the field I have to add an additional set of backslashes. If I am searching for an exact match the number of backslashes changes. I'm using a PHP script to store and retrieve some data and unless I can figure out why this is happening I will have to deal with it in my program. Anyway, this is best illustrated with an example. Lets say I have a table with one field, and I have three rows, like so: mysql> select message from im; +---------+ | message | +---------+ | Mike | | Mike's | | Mike\'s | +---------+ 3 rows in set (0.00 sec) Now, let's say I want to find the third row listed using an exact match: mysql> select message from im where (message = 'Mike\\\'s'); +---------+ | message | +---------+ | Mike\'s | +---------+ 1 row in set (0.00 sec) This behaves as I would expect (and according to the documentation I've read). Now, my understanding is that I SHOULD be able to retrieve the same result with a LIKE statement, but look: mysql> select message from im where (message LIKE 'Mike\\\'s'); +---------+ | message | +---------+ | Mike's | +---------+ 1 row in set (0.00 sec) That's not the result I expected at all...it looks like it ignored two of my backslashes (as if I had typed "...message LIKE 'Mike\'s');" To find the one I want with a LIKE statement, I have to add two MORE backslashes, like so: mysql> select message from im where (message LIKE 'Mike\\\\\'s'); +---------+ | message | +---------+ | Mike\'s | +---------+ 1 row in set (0.00 sec) If ANYONE could explain this behavior or at the very least point me in the direction of some resource that explains it I would be extremely grateful. I apologize if this is a basic or obvious question, but I have looked through the documentation on www.mysql.com and haven't found anything explaining this. Thanks in advance to anyone who can help... --------------------------------------------------------------------- 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