1

I have a table in my Mysql db (utf-8). I want to get exact word matches from this table. My query is:

SELECT matched_rows FROM MY_TABLE WHERE string = 'MY_STRING'

Problem is when I search for 'ağaç' (tree in English) I got all rows with ağaç, agac, ağac, agaç. what I want to get is only 'ağaç' not the rest. I also don't want results with something agac.

How do I get this effect?

Peter O.
  • 32,158
  • 14
  • 82
  • 96

3 Answers3

1

i followed @gintas answer and made some modifications. in the end this one worked for me:

SELECT ROWS FROM MY_TABLE WHERE CONVERT(string_field_name USING latin5) = CONVERT('MY_STRING' USING latin5)

0

You should try defining collation in the query

SELECT matched_rows FROM MY_TABLE WHERE string = 'MY_STRING' COLLATE utf8_general_ci 
gintas
  • 2,118
  • 1
  • 18
  • 28
0
SELECT * FROM users WHERE email REGEXP '[[:<:]]abhi[[:>:]]'

 try this link on SO i think you didnt try this? 

LINK: url

Community
  • 1
  • 1
abhijit
  • 1,958
  • 3
  • 28
  • 39