Select int and division using MYSQL

How to select int and then divide it by 100 using MYSQL?

+3
source share
3 answers
Select (field / 100) as divided
  From Table;
+6
source

Simple separation. The question is, do you want integer arithmetic?

For example, 163/100 = 1. Thus, you need to implicitly or explicitly convert it to get 1.63

SELECT MyColumn * 1.0 / 100 FROM MyTable

or

SELECT MyColumn / 100.0 FROM MyTable
+2
source

Try this sql query:

SELECT 16800 /* = an int */ / 100
+1
source

Source: https://habr.com/ru/post/1781113/


All Articles