Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql SQL按字符串计数不正确_Mysql_String_Utf 8_Count_Ascii - Fatal编程技术网

Mysql SQL按字符串计数不正确

Mysql SQL按字符串计数不正确,mysql,string,utf-8,count,ascii,Mysql,String,Utf 8,Count,Ascii,好的,我查了一下,似乎没有人问这个问题 所以我有两个词: thiep cuoi thiệp cưới 问题是,当我计算()时,这些mysql将把这两个组合起来。例如,此sql: #lets assume these two words have an id of 1 and 2 and that the column name #in the table is `word` SELECT `word`, COUNT(`word`) FROM table_name WHERE `id` IN

好的,我查了一下,似乎没有人问这个问题

所以我有两个词:

thiep cuoi
thiệp cưới
问题是,当我计算()时,这些mysql将把这两个组合起来。例如,此sql:

#lets assume these two words have an id of 1 and 2 and that the column name
#in the table is `word`

SELECT `word`, COUNT(`word`)
FROM table_name 
WHERE `id` IN(1,2)
GROUP BY `word`;

将两个单词作为一行返回,计数为2。通过UTF-8,这些词是不同的,我如何在MySQL中绕过这种行为?MySQL是否按UTF-8分组而不转换为ASCII/

MySQL使用您在列上设置的排序规则来确定单词中字母的相等性。在本列上设置的任何排序规则中,出于比较的目的,这些字母都被视为相等的。MySQL没有进行任何类型的转换或丢弃任何数据


您可能正在使用拉丁语1\u general\u ci或utf8\u general\u ci等常见语言。如果您希望这些字母被视为不同的,那么您可能需要一个二进制排序规则。运行一个查询,如
显示排序规则,如'utf8%'
,查看服务器上有什么可用功能。

是的,utf8-bin解决了这个问题。还发现: