I wrote query for filter data using name and wrote following query
SELECT * FROM (`abc`) WHERE (name LIKE "%test\'!&@#$\%-(3)\_er%")
It should return records which has name start with text " test " but it will not instead of if I modify query like
SELECT * FROM (`abc`) WHERE (name LIKE "%test%\'!&@#$\%-(3)\_er%")
then it will give result. Why it is not give result with first query? Is there any other way to do this?
The %
is the wildcard in the query.
So %test
means everything that ends with test
.
and test%
means everything that begins with test
.
and %test%
means everything with test
in it.
Simpy change your query to
SELECT * FROM (
abc ) WHERE (name LIKE "test%")
如果要以test
开头的记录,只需使用
SELECT * FROM (`abc`) WHERE (name 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.