MySQL regex query case insensitive

后端 未结 4 842
天涯浪人
天涯浪人 2021-02-14 16:25

In my table I have firstname and last name. Few names are upper case ( ABRAHAM ), few names are lower case (abraham), few names are character starting with ucword (Abraham).

4条回答
  •  一个人的身影
    2021-02-14 17:16

    I think you should query your database making sure that the names are lowered, suppose that name is the name you whish to find out, and in your application you've lowered it like 'abraham', now your query should be like this:

    SELECT * FROM `test_tbl` WHERE LOWER(cus_name) = name
    

    Since i dont know what language you use, I've just placed name, but make sure that this is lowered and you should retrieve Abraham, ABRAHAM or any variation of the name!

    Hepe it helps!

提交回复
热议问题