Hi Roger, Thanks for the thorough explanation. I think I got it now ;-)
Best regards Nils Valentin Tokyo/Japan 2003年 8月 14日 木曜日 20:47、Roger Baklund さんは書きました: > * 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 -- --- Valentin Nils Internet Technology E-Mail: [EMAIL PROTECTED] URL: http://www.knowd.co.jp Personal URL: http://www.knowd.co.jp/staff/nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]