Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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
Comment

PREVIOUS NEXT
Code Example
Sql :: sql insert values into table 
Sql :: how to force truncate a table in mysql 
Sql :: sql get month and year from date 
Sql :: symfony Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails 
Sql :: new uniqueidentifier in sql 
Sql :: difference between outer join and inner join sql 
Sql :: mysql command prompt date insert format 
Sql :: sql server: how to concatenate column data using comma 
Sql :: SQL SELECT TOP Equivalent in MySQL 
Sql :: using distinct and count together in sql 
Sql :: how to get max from each department in sql 
Sql :: Sequelize model datatype of enum 
Sql :: how to convert external table to managed table in hive 
Sql :: sql like case sensitive 
Sql :: to show sp in sql server 
Sql :: export database sql file from xampp using cmd 
Sql :: flask-sqlalchemy filter_by contains 
Sql :: SELECT everything from a sql table 
Sql :: timestamp sql 
Sql :: sql describe 
Sql :: mysql error 1114 (hy000) the table is full 
Sql :: mysql workbench format date 
Sql :: set engine to innodb 
Sql :: select count concat string sql server 
Sql :: oracle uptime 
Sql :: cara menampilkan user di mysql terminal 
Sql :: select multiple tables mysql 
Sql :: SQL Greater than () 
Sql :: dump db only triggers mysql 
Sql :: keep getting an error when I try to connect to mysql workbench 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =