MySQL REGEXP query - accent insensitive search

前端 未结 7 1928
清歌不尽
清歌不尽 2020-12-19 00:46

I\'m looking to query a database of wine names, many of which contain accents (but not in a uniform way, and so similar wines may be entered with or without accents)

7条回答
  •  遥遥无期
    2020-12-19 01:05

    I have this problem, and went for Álvaro's suggestion above. But in my case, it misses those instances where the search term is the middle word in the string. I went for the equivalent of:

    SELECT *
    FROM `table`
    WHERE wine_name = 'Faugères'
       OR wine_name LIKE 'Faugères %'
       OR wine_name LIKE '% Faugères'
       OR wine_name LIKE '% Faugères %'
    

提交回复
热议问题