How to round an average to 2 decimal places in PostgreSQL?

后端 未结 8 1514
渐次进展
渐次进展 2020-11-30 18:01

I am using PostgreSQL via the Ruby gem \'sequel\'.

I\'m trying to round to two decimal places.

Here\'s my code:

SELECT ROUND(AVG(some_column)         


        
8条回答
  •  半阙折子戏
    2020-11-30 18:20

    Error:function round(double precision, integer) does not exist

    Solution: You need to addtype cast then it will work

    Ex: round(extract(second from job_end_time_t)::integer,0)

提交回复
热议问题