[SOLVED] Format number to 2 decimal places

Issue

I would like to know how can I output a number with 2 decimal places, without rounding the original number.

For example:

2229,999 -> 2229,99

I already tried:

FORMAT(2229.999, 2)
CONVERT(2229.999, DECIMAL(4,2))

Solution

You want to use the TRUNCATE command.

https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_truncate

Answered By – jasonlfunk

Answer Checked By – Mildred Charles (BugsFixing Admin)

Leave a Reply

Your email address will not be published.