I’ve tried an integer column and a decimal column but whenever I try to input the figure ‘11.50’ it automatically changes it to ‘12’.
I’m also using the SUM() function on these columns so using varchar or something similar isn’t an option.
I cant see why my figure changes within an integer or decimal column.
From the MySQL manual:
When declaring a DECIMAL or NUMERIC column, the precision and scale can be (and usually is) specified; for example:
In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. If the scale is 0, DECIMAL and NUMERIC values contain no decimal point or fractional part.
So make sure that when you specify a column to be decimal that you specify the pricision and the scope.
The number of digits before the decimal can be calculated by substracting scope from precion, and the number of digits after the decimal is the scope.
So the maximum of a DECIMAL(5,2) is 999.99, for DECIMAL(6,2) it is 9999.99, etc