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)
Try casting your column to a numeric like:
SELECT ROUND(cast(some_column as numeric),2) FROM table
Try with this:
SELECT to_char (2/3::float, 'FM999999990.00'); -- RESULT: 0.67
Or simply:
SELECT round (2/3::DECIMAL, 2)::TEXT -- RESULT: 0.67