开发者

What is the SQL Query To Find in MySQL DB Table without considering the accented letters?

Like the Title开发者_如何学Go.

What is the SQL Query To Find in MySQL DB Table without considering the accented letters?

So, if I search "abcdè" I find "abcde"


By default utf8 strings ignore accents as they use the utf8_general_ci collation.

If you're not using utf8 (and why not?) Then you probably want to use the COLLATE command:

http://dev.mysql.com/doc/refman/5.0/en/charset-collate.html

 SELECT *
 FROM t1
 WHERE _latin1 'Müller' COLLATE latin1_german2_ci = k;

 SELECT *
 FROM t1
 WHERE k LIKE _latin1 'Müller' COLLATE latin1_german2_ci;

Also, you can apparently use the 'SET NAMES' command to alter the comparisons:

MySQL diacritic insensitive search (spanish accents)


Collation is the set of rules your DB is using to compare values. "all" you have to do is choose the right collation for your application. That said, @Danack57 above already gave you that piece of information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜