Skip to content
Advertisement

Want decimal result Amazon Redshift

I am trying to calculate the average ice creams a kid will have during summer. I want the result to have 2 decimals. Query:

Select day, (sum(ice_cream_cones) *1.0)/(select count(kids)) 
From t1 Group by 1

The result I get is something like 1.0003. I only want 2 decimal points. Any suggestions?

Advertisement

Answer

You can do this with round

Select day, round((sum(ice_cream_cones) *1.0)/(select count(kids) ), 2)
From t1
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement