|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Strange problem with MySQL string comparison
I have been using MySQL on and off for a number of years but I am
stumped by this problem. I am doing a select which requires a join to a second table using an account key, I have a WHERE clause which ensures that I only get the correct type of account. Basically the type of account is 'CUSTMER' but if I use the code WHERE AC****.TYPE="CUSTMER" Then I get no matches. However, if I use WHERE STRCMP(AC****.TYPE,"CUSTMER")=0 Then I get matches as expected. Could anyone explain why I get a result set with a STRCMP match, but not with the equals operator? TIA |
|
#2
|
|||
|
|||
|
Strange problem with MySQL string comparison
I should add that the AC****.TYPE field is upper case.
Further to the above, if I use a query containing the following;- WHERE LEFT(AC****.TYPE,8)="CUSTMER" Then I get all expected matches for the query. The only thing that does not work is the direct comparison using the equals operator. btw. Version of MySQL is 5.0.27 running on Fedora Core 5. |
|
#3
|
|||
|
|||
|
Strange problem with MySQL string comparison
In Standard SQL, single quotes enclose a string literal and double
quotes enclose a user-declared identifier that would otherwise be illegal (i.e. has spaces, special characters, etc.). |
![]() |
| Viewing: Web Development Archives > FAQs > Databases > Strange problem with MySQL string comparison |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|