TheOnlyIdiot
TheOnlyIdiot

Reputation: 1202

mysql - Why "n" is included when I search for "ñ"?

I have a problem. When I have this code SELECT FIRST_NAME FROM CONTACT WHERE FIRST_NAME LIKE '%ñ%' why is it returning all FIRST_NAME that has n without ñ. Im expecting only those that have ñ. Thanks in advance.

Upvotes: 11

Views: 7915

Answers (2)

John Woo
John Woo

Reputation: 263843

SELECT FIRST_NAME 
FROM CONTACT 
WHERE FIRST_NAME LIKE '%ñ%' COLLATE utf8_spanish_ci 

Upvotes: 14

Devart
Devart

Reputation: 122032

Try to use a BINARY operator to compare strings in binary way -

SELECT FIRST_NAME FROM CONTACT WHERE FIRST_NAME LIKE BINARY '%ñ%'

Upvotes: 15

Related Questions