I would like to match this 'wildcard %'
in MySQL.
I tried using escape \%
and it is not working.
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
You need to escape the \ in PHP string as well, otherwise PHP would think that you are actually escaping the %, thus sending literal % to the sql query, so I think this should work:
ok i need to use doble
(\\)
to match the % in the databaseIn latest version you can also try
regards
Here is an example:
The default escape character is
\
. So just prefix%
with a\
as:\%
:The manual clearly says:
Search for
%
inStack%Overflow
:Search for
%
inStackOverflow
:EDIT:
If you are calling this query from PHP, you'll have to use
\\
. This is because even PHP uses\
as the escape character. So make MySQL get a\
you need to have\\
in PHP.