I use pgAdmin 4.. and I am trying to figure out, how to round column rental_period, which was extracted from deducting 2 timestamp columns and now consists out of double precision data type. I want to round it on 2 decimal places. Here is the script that returns error:
SELECT customer_id, ROUND (AVG (extract (day from (return_date - rental_date))), 2) AS rental_period
FROM rental
GROUP BY customer_id;
The error says:
ERROR: syntax error at or near "AS"
LINE 1: ...xtract (day from (return_date - rental_date)), 2) AS rental_... ^ SQL state: 42601
Character: 84
And here is a script which works fine, but returns too many decimal places:
SELECT customer_id, AVG (extract (day from (return_date - rental_date))) AS rental_period
FROM rental
GROUP BY customer_id;
Thank you)
return_date
andrental_date
? – a_horse_with_no_name Oct 11 '19 at 10:22