I MySQL rookie a
Problems encountered with wildcards help you, big God.
I want to select the data in the users table with the name "Szo" or "Szö"
So write the following code:
SELECT * from the users where name like '%sz[oö]% '
The database has such data
But the return value is 0.
Try
SELECT * from the users where name like '%szo% ' or the name like '%szö% '
With results
May I ask what is different between the two?
Reply to discussion (solution)
MySQL like wildcard characters are only "_" and "%"
"_" is a match for any single character
"%" is a match for any number of characters.
SELECT * from the users where name like '%sz[oö]% '
The name contains a record of sz[oö].
Instead of records that contain Szo or szö
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
MySQL like wildcard characters are only "_" and "%"
"_" is a match for any single character
"%" is a match for any number of characters.
SELECT * from the users where name like '%sz[oö]% '
The name contains a record of sz[oö].
Instead of records that contain Szo or szö
Got a solution?
SELECT * from the users where name like '%szo% ' or the name like '%szö% '
Haven't you already solved it with this method?
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
No way? How did you write the regexp?
SELECT * from users where name RegExp ' Sz[oö] '
SELECT * from userswhere nameregexp ' (A-Z) *sz (O|ö) (A-Z) * ' LIMIT 0, 30
Okay, thanks, everybody.
Knot posts
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
No way? How did you write the regexp?
SELECT * from users where name RegExp ' Sz[oö] '
Because like does not recognize [oö],regexp does not recognize%, so pull
SELECT * from userswhere nameregexp ' (A-Z) *sz (O|ö) (A-Z) * ' LIMIT 0, 30
SELECT * from the users where name like '%szo% ' or the name like '%szoö% '
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
No way? How did you write the regexp?
SELECT * from users where name RegExp ' Sz[oö] '
Try your code more than my simple and useful
Thank you for not being my rookie. Patient answer
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
No way? How did you write the regexp?
SELECT * from users where name RegExp ' Sz[oö] '
Because like does not recognize [oö],regexp does not recognize%, so pull
SELECT * from userswhere nameregexp ' (A-Z) *sz (O|ö) (A-Z) * ' LIMIT 0, 30
Now that you've used regexp, what's the use of%? This is like wearing hiking shoes to play basketball?
SELECT * from the users where name like '%szo% ' or the name like '%szö% '
Haven't you already solved it with this method?
It's a long story, and it's aäiïuü trouble.
Like is not a regular expression match. Instead of matching wildcard characters% and _, this is not supported for [XY] groups.
You can try RegExp
Tried, the same result
Is there any other way?
No way? How did you write the regexp?
SELECT * from users where name RegExp ' Sz[oö] '
Try your code more than my simple and useful
Thank you for not being my rookie. Patient answer
It's polite. Who didn't come from the rookie.
Mastering certain skills can often double the efficiency of learning.