P
P
Puma Thailand2012-04-02 09:26:26
MySQL
Puma Thailand, 2012-04-02 09:26:26

Case-insensitive search for like does not work

The actual query
SELECT *
FROM (
`users`
)
WHERE `username` LIKE '%JNC%'
LIMIT 0, 30 Looks for a

row with username MYJNC

And the query
SELECT *
FROM (
`users`
)
WHERE `username` LIKE '%jNC%'
LIMIT 0, 30

username varchar(50) encoding utf8_bin

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2012-04-02
@opium

I changed the encoding for the varchar to utf8_general_ci and everything was fine.

Z
ztxn, 2012-04-02
@ztxn

directly
upper(`username`) LIKE upper('%jNC%')
but in general dev.mysql.com/doc/refman/5.6/en/case-sensitivity.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question