Databases
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs Databases

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old June 5th, 2008, 07:10 AM
jammypodger
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old June 5th, 2008, 07:10 AM
jammypodger
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #3  
Old June 6th, 2008, 05:10 PM
--CELKO--
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.).


Reply With Quote
Reply

Viewing: Web Development Archives FAQs Databases > Strange problem with MySQL string comparison


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT