[ACCEPTED]-How to match one character in MySQL in place of %?-mysql

Accepted answer
Score: 53

You want to use an underscore (_) character. See 1 the documentation here.

Score: 20

_ will match exactly one character :

select * from X where Y like "_s"

0

Score: 5

An easy way you can do it if you know the 3 domain of characters to match:

select * from X where Y like '[a-z]s'

or like this

select * from X where Y like '[a-zA-Z0-9]s'

alternatively 2 you could use the _ (underscore) syntax 1 like follows:

select * from X where Y like '_s'

More Related questions