Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mySQL - query to get floor() or round() to next lowest 100 unit (hundred block number for address)

Tags:

mysql

I am trying to create a query to take integer street address numbers and get the hundred block number for the address. E.g. any value from 300 to 399 yields 300 etc.

Is this possible in a single query or should I write a script?

like image 519
jerrygarciuh Avatar asked Jan 12 '12 17:01

jerrygarciuh


1 Answers

you can use floor like this :

SELECT FLOOR(399/100)*100;
like image 121
Assaf Karmon Avatar answered Nov 15 '22 02:11

Assaf Karmon