Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL - How do I get only the numbers after the decimal?

How do I get only the numbers after the decimal?

Example: 2.938 = 938

like image 531
user380432 Avatar asked Aug 05 '10 19:08

user380432


People also ask

How do you get only the numbers before the decimal in SQL?

Use TRUNC(158.96) to get the digits before decimal point. no need to remove the decimal part for comparison.

How do I restrict decimal places in SQL?

SQL Server ROUND() Function The ROUND() function rounds a number to a specified number of decimal places. Tip: Also look at the FLOOR() and CEILING() functions.


1 Answers

try this:

SELECT (num % 1) 
like image 115
Pavel Morshenyuk Avatar answered Sep 23 '22 11:09

Pavel Morshenyuk