user3256212
user3256212

Reputation: 107

remove case sensitive in mysql search

I am write a query for search like:

SELECT * from page where (UPPER(page_title) LIKE 'PRIYA%');

But in my database i have a multiple result of priya like Priya_patel ,Priya_Patel ,Priya_d but the result was empty for this query.

My data in page_title field is:

Priya_patel, Priya_Patel,Priya_d_patel,Priya_yahoo,Priya_Mansi

Upvotes: 0

Views: 2754

Answers (3)

Balaji Kandasamy
Balaji Kandasamy

Reputation: 4506

Your query is working correctly,

SELECT * FROM toto WHERE (UPPER( name ) LIKE  'PRIYA%')

also you can try like this to get the case insensitive result,

SELECT * FROM page WHERE LOWER(  `page_title` ) LIKE LOWER(  "PRIYA%" )

Upvotes: 0

webzar
webzar

Reputation: 114

For the table field "page_title" select COLLATION to 'utf8_unicode_ci' or to some which is having _ci as suffix in it.

ci in '_ci' stands for Case Insensitive.

Then you execute the following query

SELECT * from page where page_title LIKE 'PRIYA%';

or

 SELECT * from page where page_title LIKE 'priya%';

or whatever ....

Upvotes: 1

Ravi Dhoriya ツ
Ravi Dhoriya ツ

Reputation: 4414

Your query is perfectly working. Problem is somewhere else.

SELECT * from page where (UPPER(page_title) LIKE 'PRIYA%');

Check DEMO

Upvotes: 0

Related Questions