I'm trying to get names using Like '%BEJO%'
, but no record is found because my data in database is 'Bejo'
.
How I do I get the name 'Bejo'
with LIKE '%BEJO%'
? (case insensitive)
I'm trying to get names using Like '%BEJO%'
, but no record is found because my data in database is 'Bejo'
.
How I do I get the name 'Bejo'
with LIKE '%BEJO%'
? (case insensitive)
Try this:
select t1.*
from table1 t1
where LOWER(column_name) LIKE LOWER('%BEJO%');
It seems the collation of that column is case-sensitive. If you want it to always be case-insensitive, then change its collation to the one that ends with ci
. If you want to keep it the way it is and only make the query case-insensitive, then you can change the collation in the query. Example:
SELECT *
FROM table1
WHERE name LIKE '%BEJO%' COLLATE utf8_general_ci;
Alternatively, you can simply change the case of both sides using LOWER()
or UPPER()
. Example:
SELECT *
FROM table1
WHERE UPPER(name) LIKE UPPER('%BEJO%');