I want to correct a table field, as I have values like this: 123456789
and want to change to 1234567.89
I want to correct a table field, as I have values like this: 123456789
and want to change to 1234567.89
To put the decimal places, you only have to multiply the value by 0.01. 123456789 * 0.01 = 1234567.89
update table set coldecimal = coldecimal * 0.01
But first, change the column type.
Run the command:
ALTER TABLE tabela MODIFY coluna DECIMAL(10, 2);
I got the following code
update cad_recibo SET valor_recibo = REPLACE(valor_recibo, '00.00', '.00');
So if you have any cents you do not change. so I wanted some way to make the values with cents too