MySQL Forums
Forum List  »  Perl

Re: Select query returns false result.
Posted by: Rick James
Date: February 04, 2013 09:03PM

What should MySQL do when comparing and INT and a string? Tough question. The choice they made was to interpret the string as a number.

How is a string interpreted as a string? The string is parsed as a number until that fails, hence 10 in your example. BTW, 'xyz' is treated as 0.

WHERE CONCAT(id, '') = '10abc'
would be a string compare

WHERE id = '10abc' + 0
would convert the string to a number, but because of "+", not because of "=".

Etc.

Options: ReplyQuote


Subject
Written By
Posted
Re: Select query returns false result.
February 04, 2013 09:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.