mysql query behaves differently when value is quoted
MySQL 5.0, Acct is a varchar field, so why is the query behaving differently?
select *
from a开发者_StackOverflow社区cct_codes
where Acct = 10100;
/* returns a record */
select *
from acct_codes
where Acct = '10100';
/* returns no record */
How can I troubleshoot this? Can I typecast this somehow to guarantee I will always get the record? Please help.
This is how you can cast to INTEGER:
CONVERT( '10100', SIGNED INTEGER );
I found the problem.
I did a dump of the table and there was a carriage return at the end of the data.
精彩评论