gpt4 book ai didi

php - 类似声音的Mysql搜索结果

转载 作者:行者123 更新时间:2023-11-29 06:36:38 27 4
gpt4 key购买 nike

假设我有一个用户表。用于用户名字的表存储的列之一。还假设表中有行。用户名字如下:'苏曼','召唤','帕皮亚'。现在我想要一个 mysql 查询,如果用户使用“Suman”按用户名从表中搜索,那么结果将显示两行,一行用于“Suman”,另一行用于“Sumon”。

最佳答案

您可以使用 soundex它将比较 firstname 中值的发音是否与提供的单词的发音匹配

根据文档

When using SOUNDEX(), you should be aware of the following limitations:

  • This function, as currently implemented, is intended to work well with strings that are in the English language only. Strings in other
    languages may not produce reliable results.

  • This function is not guaranteed to provide consistent results with strings that use multi-byte character sets, including utf-8.

select *
from t
where soundex(firstname)=soundex('Suman')

Demo

关于php - 类似声音的Mysql搜索结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24250267/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com