Re: MySQL returns the same result using the IN clause irrespective of the value used
Posted by: Peter Brawley
Date: July 15, 2015 01:55PM

From the absence of quotes, MySQL makes the shortcut assumption that the varchar value is to be interpreted as a number, and evaluates it as a double, which obviously rounds.

To make the comparison with the value as a varchar, surround it with quotes ...

where cast(test_id) = '792718488739137399'

To make the comparison as an int, use something like ...

where cast(test_id as unsigned) = 792718488739137399

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL returns the same result using the IN clause irrespective of the value used
1135
July 15, 2015 01:55PM


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.