简体   繁体   English

MySQL获得完全相同的字符串匹配,但键入不同的特殊字符

[英]Mysql get exact match of same string but typed with different special chars

Hey guys i got an interesting situation! 嘿,我有一个有趣的情况!

In Turkish language we have ı,ç,ğ,ö,ş and uppercase of them. 在土耳其语中,我们有ı,ç,ğ,ö,ş和大写字母。 I also have a huge table of threads with turkish titles. 我也有一个巨大的带有土耳其标题的线程表。

like in this example : 像这个例子:

mysql> select id,title from xr_threads where title = 'birinci';
+--------+---------+
| id     | title   |
+--------+---------+
|     67 | birinci |
|  34635 | bırıncı |
| 322727 | birinçi |
+--------+---------+
3 rows in set

Query in my function always grabs the first one. 我的函数中的查询总是抓住第一个。 However if I run this query again with title = 'bırıncı' mysql grabs these 3 results again. 但是,如果我再次使用title ='bırıncı'来运行此查询,则mysql将再次获取这3个结果。 I want mysql to only get 34635 id but no matter what I typed it always gets these 3 result. 我希望mysql仅获得34635 id,但是无论我键入什么,它始终会得到这3个结果。 Why it is not getting the matched one? 为什么没有得到匹配的?

Try: 尝试:

mysql> select id,title from xr_threads where title = BINARY 'birinci';

More info about the BINARY operator use on the MySQL doc page http://dev.mysql.com/doc/refman/5.0/en/charset-binary-op.html 有关BINARY运算符使用的更多信息,请参见MySQL doc页面http://dev.mysql.com/doc/refman/5.0/en/charset-binary-op.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM