MySQL:set result two digits behind comma
Question
i have some formula:
CONCAT((SUM(X.lot_qty)-SUM(X.reject))/SUM(X.accept)*100,'%') AS Acceptance
but i get result like:
100.0000%
how to get result as 100.00%?
Solution
You can use the MySQL ROUND function as:
CONCAT(ROUND((SUM(X.lot_qty)-SUM(X.reject))/SUM(X.accept)*100,2),'%') AS Acceptance
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow