Cerca char accentuata in mysql
-
21-09-2019 - |
Domanda
Ho bisogno di trovare le occorrenze di E ou E in una tabella mysql.
Per prima provato: SELECT "lel" come "% E%"; che non funziona:. restituisce parola che contiene E o E oe
Ho anche provato con regex senza risultati (utilizzando la lettera L):
SELECT "Lbc" REGEXP ".*L.*"; -- works : it finds L in the string LBC
SELECT "Lbc" REGEXP ".*\u4C.*"; -- doesn't work : can't find the hexadecimal equivalent of L in the string LBC.
ho voluto testare la \ u più ricerca esadecimale ... ho anche provato a doppia fuga come menzionate nelle doc, senza modifiche.
Regex ricerca sembra essere veramente limitata in mysql. Non hai trovato alcun documento relative al \ u sul http: // dev .mysql.com / doc / refman / 4.1 / it / regexp.html .
Sto usando MySQL 4.1.
Se c'è una soluzione in MySQL 5, che non esiste in 4, mi piacerebbe sapere su di esso.
Soluzione
SELECT 'LéL' LIKE '%é%' COLLATE utf8_bin;
/* latin1_bin if your data is in latin1, etc. */
1
SELECT 'LéL' LIKE '%e%' COLLATE utf8_bin;
0
http: // dev. mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like e http://dev.mysql.com/doc/refman/5.0/en/charset-binary-collations.html
testato in MySQL 5.1 -. Dovrebbe funzionare a 4.1, anche