MySQL Forums
Forum List  »  InnoDB

LIKE not working as expected
Posted by: Robert Simpson
Date: April 18, 2020 08:37PM

When searching for values containing a backslash, MySQL is not finding the rows as expected. Here's an example:

create table t (c varchar(50)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
insert into t values ('test\\test');
select * from t where c like '%\\\\test' escape '\\';

No rows are returned.

Changing the number of escaped backslashes in the "like" expression doesn't help. This is on MySQL 5.1.73 on RedHat.

Options: ReplyQuote


Subject
Views
Written By
Posted
LIKE not working as expected
191
April 18, 2020 08:37PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.