Hi ,
In my query I need to display date and average age:
SELECT (SYSDATE-rownum) AS DATE,
avg((SYSDATE - rownum)- create_time) as average_Age
FROM items
group by (SYSDATE-rownum)
output will be something like:
Date_in Average Age
24/JUN/15 20
23/JUN/15 19
22/JUN/15 18
But my output for average age is not correct.It's simply calculating/displaying the output of (SYSDATE - rownum)- create_time but not calculating the average of them though i use -
avg((SYSDATE - rownum)- create_time) .
Can someone tell me why the aggregate function AVG is not working in my query and what might be the possible solution