I'm in the process of normalising a database, and part of this involves converting a column from one table from a FLOAT
to a DECIMAL(28,18)
. When I then try to join this converted column back to the source column, it returns no results in some cases.
It seems to bee something to do with the ways its converted. For example, the FLOAT
converted to a DECIMAL(28,18)
produces:
51.051643260000006000
The original FLOAT
is
51.05164326
I have tried various ways of modifying the FLOAT
, and none of these work either:
CAST(51.05164326 AS DECIMAL(28,18)) = 51.051643260000000000
STR(51.05164326 , 28,18) = 51.0516432599999990
The reason for the conversion is due to improving the accuracy of these fields.
Has anyone got a consistent strategy to convert these numbers, and be able to ensure subsequent joins work?
Thanks in advance
CM