How do you use MAX and ROUND at the same time?
i.e.
SELECT customer_id, MAX(some_number) FROM customer_data GROUP BY customer_id;
60.2354125
Would like to return the result of 60.24
How do you use MAX and ROUND at the same time?
i.e.
SELECT customer_id, MAX(some_number) FROM customer_data GROUP BY customer_id;
60.2354125
Would like to return the result of 60.24
You would write this as:
SELECT customer_id, ROUND(MAX(some_number), 2)
FROM customer_data
GROUP BY customer_id;
EDIT:
Based on your comment, you can convert to a numeric first:
SELECT customer_id, ROUND(MAX(some_number)::numeric, 2)
FROM customer_data
GROUP BY customer_id;
Thanks for pointing me in the right direction @Gordon. The solution was casting as numeric
round(MAX(cast(some_number as numeric)),2)