Jump to content

[SOLVED] run a MySQL select quary with insensitive case.


Recommended Posts

Mysql is ,by default, case insenstive. A standard comparison query (using the = sign) is case insenstive. You can make searches case senstive, however.

 

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

SELECT HIGH_PRIORITY *
FROM downloads
WHERE `downloads`.`Title` = "My first dl"

--============

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` 
LIKE "My first dl"

 

i need the Title to be case insensitive... in the ways above it is case-sensitive!!!

anyone can help ?

 

I'd like to add 1 more EZ question that might help me alot!!!

- how do i get the latest indexed item from a certain table ?!

(Currently i'm using a redicules method which is select... where 1, and the feching the row numbers.)

 

THANKS IN ADVANCE !!!

As the link i posted shows, you need to set the collation to one of the case senstive options. If you want all of your searches on that field to be case senstive, then modify the collation on the field.

 

If you just want this particular query to be case sensitive, then try:

 

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE latin1_general_cs = "My first dl"

@GingerRobot

dear mr.dude, i don't want case-sensitive !!!

- i want case-IN-sensitive... how do i do that ?

 

p.s - i've read the page you've gave me many times already - still no clue why do i need to read it as i don't want my searches case-sensitive BUT case-IN-sensitive...

 

please help me sir.

why can't i edit my own post... bah - it's not a spam and sorry for the double post!

 

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_bin = "My first dl"

-======

SELECT HIGH_PRIORITY *
FROM downloads
WHERE `downloads`.`Title` = "My first dl"

-======

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` 
LIKE "My first dl"

 

All of these give me no return! - 0 rows. {used directly on the mysql interface.}

but all of the following do give me the requested entry!!!

-. notice the M-m changes.

 

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_bin = "my first dl"

-======

SELECT HIGH_PRIORITY *
FROM downloads
WHERE `downloads`.`Title` = "my first dl"

-======

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` 
LIKE "my first dl"

 

any idea anyone ?!

already over 8 hours trying to figure it out....

Hmm, well looks like i misread. I can only assume that the field title has a case sensitive collation.

 

Try this query:

 

SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_general_ci = "my first dl"

 

If that works, then modify the collation on the field.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.