Jump to content

[SOLVED] MYSQL help......


thenature4u

Recommended Posts

I have a table tbluserdetails.

 

username  Joindate              email

kElvin        2008-10-9            abc@xyz.com

 

alex          2008-10-9            abcf@xyz.com

 

Austin      2008-10-9            abce@xyz.com

 

john          2008-10-9            abcd@xyz.com

 

With mysql query, i want to retrieve the user records, who has capital letter in their username.

 

My required output is:

 

username  Joindate              email

kElvin        2008-10-9            abc@xyz.com

Austin      2008-10-9            abce@xyz.com

 

Help me...

 

Thanks in advance.....

 

Link to comment
Share on other sites

The easiest way would be to use the mysql LOWER() function to convert the value to lower case, use the mysql BINARY operator to force the result to a binary string so that comparisons are case-sensitive, and then use the mysql STRCMP() function to check if the result is the same as to original value. If it is the same, there were no upper case letters in the value.

Link to comment
Share on other sites

thanks for your response,

 

SELECT *

FROM tablename

WHERE HEX( LOWER( username ) ) = HEX( username )

 

 

By using this query i am able to retrieve user  records who are not having capital letters in their username.

 

how to make not eqval to for the above query. So that i can get required output.

Link to comment
Share on other sites

Because

 

STRCMP(LOWER(username) , username) =1

 

would be case insensitive and would equal 0 when username contained any upper case letters.

 

I had suggested using the BINARY operator to force the comparison to be case sensitive, but HEX() gives the same results.

Link to comment
Share on other sites

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.