Yahia Baiba Yahia Baiba - 1 month ago 9
MySQL Question

MySQL View decimal place

I have a MySQL view called

Balance
created from 2 tables
order
and
income
with PHPMyAdmin and contains some calculated fields ex:
CustomerBalance
the decimal place become automatically 8, I mean the field Type is
decimal(50,8)


How can i make it 2 only ?

Answer

You can use truncate

 SELECT TRUNCATE(1.999,2);

return 1.99

 select TRUNCATE(your_column,2) from your_table;