tags:

views:

24

answers:

2

Hi to all,

i am usign concat_ws to search a table (code 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 sererate uppercase and lowercase

Thanks to all

A: 

Maybe try this:

SELECT * FROM customers WHERE LOWER(CONCAT_WS('',lastname,firstname)) LIKE '%$string%'

And search in lowercase ?

Joy Dutta
A: 
SELECT * FROM customers WHERE LOWER(CONCAT_WS('',lastname,firstname)) LIKE '%$string%'

The solution assumes, the $string variable is always lowercase.

erenon