Answers for "select mysql limit to 2 decimal places"

SQL
0

select mysql limit to 2 decimal places

/**
When formatting number to 2 decimal places you have two options TRUNCATE and ROUND.
You are looking for TRUNCATE function.
Examples:
**/

-- Without rounding:
TRUNCATE(0.166, 2)
-- will be evaluated to 0.16

TRUNCATE(0.164, 2)
-- will be evaluated to 0.16
-- docs: http://www.w3resource.com/mysql/mathematical-functions/mysql-truncate-function.php

-- With rounding:
ROUND(0.166, 2)
-- will be evaluated to 0.17

ROUND(0.164, 2)
-- will be evaluated to 0.16
-- docs: http://www.w3resource.com/mysql/mathematical-functions/mysql-round-function.php
Posted by: Guest on January-29-2022

Code answers related to "select mysql limit to 2 decimal places"

Code answers related to "SQL"

Browse Popular Code Answers by Language