Round sum of decimal column in sql Round sum of decimal column in sql sql sql

Round sum of decimal column in sql


The ROUND() function is used to round a numeric field to the number of decimals specified.

Syntax:

SELECT ROUND(column_name,decimals) FROM table_name;

For your problem, try this:

CONVERT(int,ROUND(SUM(Amount),0)) as TotalAmount --Converting to int to remove the fractional part

Read more about ROUND here.


If you want to round and remove the fractional part you can simply CAST it to a DECIMAL with different precision:

select cast(SUM(Amount) as DECIMAL(18,0)) as TotalAmount


Round

ROUND(SUM(Amount),0) as TotalAmount 

SQL FIDDLE