Jump to content

[SOLVED] MYSQL help......


thenature4u

Recommended Posts

I have a table tbluserdetails.

 

username  Joindate              email

kElvin        2008-10-9            [email protected]

 

alex          2008-10-9            [email protected]

 

Austin      2008-10-9            [email protected]

 

john          2008-10-9            [email protected]

 

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            [email protected]

Austin      2008-10-9            [email protected]

 

Help me...

 

Thanks in advance.....

 

Link to comment
https://forums.phpfreaks.com/topic/122876-solved-mysql-help/
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
https://forums.phpfreaks.com/topic/122876-solved-mysql-help/#findComment-634590
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
https://forums.phpfreaks.com/topic/122876-solved-mysql-help/#findComment-634624
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
https://forums.phpfreaks.com/topic/122876-solved-mysql-help/#findComment-634975
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.