as the title explain..
is there any way to get result order by with case insensitive?
cause if i just use select petname from pet order by petname the result are those with uppercase first, and then those without uppercase... and users may enter info like Dog, DOG or dog...
if there any extra command like..
sort by caseinsensitivo(petname)?
thanks
case insensitive order by, mysql
why not just force the case on the column? or force the case in the php code that inserts the data?
- Don't use an old decrepit version of MySQL which doesn't understand collations
- Use a case insensitive collation on that column / table / everywhere
The default collation for latin1 encodings (Swedish I think it's called, but it's appropriate to most languages which use latin1) is case insensitive. Moreover, I suspect the default collation for utf8 is case insensitive too (At least for latin-type characters).
Therefore, MySQL will do this by default.
Unless of course, you are using some ancient prehistoric version which belongs in a museum.
Mark
maybe im using and old version
ill check that.
thanks
Try this:
SELECT petname FROM pet ORDER BY LOWER(petname)