concat_ws and lowercase and uppercase
I am using concat_ws
to search a table (code given below).
SELECT * FROM customers WHERE CONCAT_WS('',lastname,firstname) LIKE '%$string%'
My problem is 开发者_开发百科that seperates uppercase and lowercase.
If I search AB I get 10 results BUT if I search ab I get 1 result.
Is there any way to get the same results, meaning not separate uppercase and lowercase?
Maybe try this:
SELECT * FROM customers WHERE LOWER(CONCAT_WS('',lastname,firstname)) LIKE '%$string%'
And search in lowercase ?
SELECT * FROM customers WHERE LOWER(CONCAT_WS('',lastname,firstname)) LIKE '%$string%'
The solution assumes, the $string
variable is always lowercase.
精彩评论