2

I'm trying to search through a MySQL table to find a specific column (as i have done many times before), but I have run into a problem, where I'm trying to search for the letter 'å', but it returns both a column with the letter 'å' and also a column with the letter 'a'.

for example.

I have a table named Categories that looks like this:

+----------+--------+
| Category | Answer |
+----------+--------+
|  cities  | abenra |
+----------+--------+
|  cities  | åbenrå |
+----------+--------+

When I then try to search through it like this SELECT * FROM Categories WHERE Category='cities' AND Answer='åbenrå' It returns the results:

+----------+--------+
| Category | Answer |
+----------+--------+
|  cities  | abenra |
+----------+--------+
|  cities  | åbenrå |
+----------+--------+

And what I was expecting and wanted was a result that looks like this:

+----------+--------+
| Category | Answer |
+----------+--------+
|  cities  | åbenrå |
+----------+--------+

So... How can I search for the letter 'å', without searching for the letter 'a' at the same time?

I really hope that you can help me! Thanks in regards.

ThorBilsby
  • 69
  • 1
  • 6

1 Answers1

3

I guess you need to apply a conversion on your keyword for exact match

SELECT * FROM Categories 
WHERE Category='cities' 
AND Answer = CONVERT('åbenrå' USING binary)

DEMO

M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118