how to display the value of avg function till only two decimal places in SQL?
shivam thaman
select avg(purch_amt) from orders;
I took an average of the amounts and it shows value till many decimal places and I would like to limit it to two decimal places. 
Here's what I have tried:-
    ...
https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196
Stack Overflow
My preferred method is to cast to an appropriate decimal value:

select cast(avg(purch_amt) as decimal(10, 2)) from orders;

This is a bit different from round(), although the two generally produce the same result. As the documentation explains for round():

The return value has the same type as the first argument (assuming that it is integer, double, or decimal)

That means that what gets displayed in an application might still show more (or fewer) than the number of decimal places. By changing the type, the application will know how many decimal places should be in the result.