简体   繁体   中英

Search by special characters

In our table contains column named as description.

The description column contains following values.

test , %test , test% .

If I give %test as input of search string , then it give "test","%test","test%" as result. But I want only "%test" as result.

% is a special character and needs to be escaped ( http://dev.mysql.com/doc/refman/5.0/en/string-literals.html )

Try "\\%test"

Snippet:

select description from tablename where decription like '\%test'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM