[Phpwm] MySQL case insensitive string comparison

alan dunn alan at dunns.co.uk
Thu Jun 24 12:47:47 UTC 2010


We use LIKE and ILIKE in pgsql. Don't know if it transposes to Mysql

so

select * from table where name ilike 'MIKE' would get you your result for 'mike'

regards, alan dunn

On 24/06/2010 13:38, Mike Tipping wrote:
> Whenever I run a select in Mysql based on a string comparison, the
> comparison is always case sensitive so where 'name' in the DB is 'mike',
> select * from table where name = 'MIKE'; won't return results.
>
> Looking at the MySQL documentation it says that case sensitivity on
> comparisons depends on the collation and if I use 'latin1_swedish_ci' (which
> I do) the comparison will be case insensitive (which it isn't).
>
> It also says that STRCMP() is by default case insensitive, but when I try
> that it still doesn't return anything.
>
> Any ideas what I might be doing wrong or what I can use to do a case
> insensitive string comparison in MySQL.
>
> Cheers
>
> Mike
>
>
>
> _______________________________________________
> Phpwm mailing list
> Website : http://www.phpwm.org
> Twitter : http://www.twitter.com/phpwm
> Facebook: http://www.facebook.com/group.php?gid=2361609907
>
> Post to list: Phpwm at mailman.lug.org.uk
> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>
>
>    



More information about the Phpwm mailing list