* Roger Baklund > > They both look for "2003's". * Nils Valentin > Thats what I also thought at first sight, but there seems to be > more to it. > > > > > The LIKE operator is a pattern matching operator. The operand > > is evaluated twice: first by the parser, and then when the > > pattern matching is performed. For your last example, the > > first evaluation changes "2003\\\'s" to "2003\'s", and the > > second evaluation changes "2003\'s" to "2003's". > > THis example works for the second one , how about the first one > in comparison ?
In your first example, the first evaluation changes "2003\'s" to "2003's", and the second evaluation does not change anything, the value is allready unescaped. If you wanted to find columns containing a backslash you would need to use something like this: SELECT * FROM mytable WHERE mycol LIKE '%\\\\%' Because of the double evaluation, this is the same as LIKE "%\%" if backslahs is not the escape character. Note that since version 3.22.9 you can use the ESCAPE option to the LIKE operator: SELECT * FROM mytable WHERE mycol LIKE '%\%' ESCAPE '|' In this case, the backslash is not handled as an escape character, and the "double doubling" is not needed. -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]