开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜