Hi, I have a table that I'd like to sum up the refills for each month, and eventually get an average. I have this query, it does order by year but the months are all over the place? Any suggestions, I've tried many other methods.
Also, is there an easy way to get an average per month?
Thanks in advance for any suggestions.
SELECT TO_CHAR(MY_DATE, 'YYYY/MM') "Date",
SUM(REFILL_QTY) "Sum of Refills by Month"
FROM MY_TEST
GROUP BY TO_CHAR(MY_DATE, 'YYYY/MM')
ORDER BY TO_CHAR(MY_DATE, 'YYYY/MM')
/
The greatest risk, is not taking one.
Also, is there an easy way to get an average per month?
Thanks in advance for any suggestions.
SELECT TO_CHAR(MY_DATE, 'YYYY/MM') "Date",
SUM(REFILL_QTY) "Sum of Refills by Month"
FROM MY_TEST
GROUP BY TO_CHAR(MY_DATE, 'YYYY/MM')
ORDER BY TO_CHAR(MY_DATE, 'YYYY/MM')
/
The greatest risk, is not taking one.