I have a MySQL view called Balance created from 2 order and income tables using PHPMyAdmin and containing some calculated ex fields: CustomerBalance decimal place automatically becomes 8, I mean the Decimal type field decimal(50,8)How can I do only 2?
Balance
order
income
CustomerBalance
decimal(50,8)
You can use truncate
SELECT TRUNCATE(1.999,2);
return 1.99
1.99
select TRUNCATE(your_column,2) from your_table;
In the select list, where you evaluate the CustomerBalance expression, explicitly truncate or round (depending on your requirements) the result to two digits:
select
select ... round(..., 2) as CustomerBalance ...
Source: https://habr.com/ru/post/1258029/More articles:How to serve static resources like json file in dev server web package? - reactjslaravel session_start () returns 1 - laravelgcloud.exceptions.Forbidden: 403 Missing or insufficient permissions - pythonThe blade.php method that outputs the result to the form - phpUsing Redux framework with Firebase in Android - androidEncoding / decoding string error - missing character from the end - pythonMultiple model classes for one firebase element - androidConvert a single column to multiple elements in a Spark Dataframe - scalaActive status sum as scd in SQL Server 2012 - sql-serverC # Console Calls Batch Batch Files - c #All Articles