How to do case insensitive WHERE statement

Soldato
Joined
4 Jul 2004
Posts
2,647
Location
aberdeen
Hello,
I need to do something like
SELECT * from table WHERE field = "whatever"
but it must also pick up all results that have field = WHATEVER, WhAtEvEr etc

How can i do case insensitive where search?
thanks
 
Have you tried what you posted?
B.5.1. Case Sensitivity in Searches

By default, MySQL searches are not case sensitive (although there are some character sets that are never case insensitive, such as czech). This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a.

http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

Although BLOB fields are case sensitive, I believe.. but I doubt your data will be BLOBs?

:)
 
Last edited:
I believe an = is case sensitive but if you use LIKE, it's insensitive. Therefore, using WHERE blah LIKE 'blah' (without any wildcards) rather than blah = 'blah' should give the desired result.
 
Back
Top Bottom