MYSQL - getting -0 for double field type


While using double data type, I face some problem where MYSQL will save 0.00 as  -0
Unable to find out what is the actual problem, there for I came out with temporary solution until i found the root cause.

Since we cannot use,

select <fieldname> from <table> where <fieldname> = -0;

You can retrieve the data by using below statement.

select <fieldname> from <table> where <fieldname> = cast(<fieldname> AS CHAR(15))="-0";
UPDATE <table> SET <fieldname> = 0 WHERE cast(<fieldname> AS CHAR(15))="-0";


No comments: