How would I round down to the nearest integer in MySQL?
Example: 12345.7344 rounds to 12345
12345.7344 rounds to 12345
mysql\'s round() function rounds up.>
round()
if you need decimals can use this
DECLARE @Num NUMERIC(18, 7) = 19.1471985 SELECT FLOOR(@Num * 10000) / 10000
Output: 19.147100 Clear: 985 Add: 00
OR use this:
SELECT SUBSTRING(CONVERT(VARCHAR, @Num), 1, CHARINDEX('.', @Num) + 4)
Output: 19.1471 Clear: 985