2021年4月8日星期四

Oracle AVG COUNT

I have this query:

SELECT TRUNC(date_added,'MM'), count(*)  FROM payments_log l, product p  WHERE l.amount > 0    AND l.product_id = p.product_id    AND p.subproduct_id = 238    AND TRUNC(l.date_added) BETWEEN TO_DATE('01012020','MMDDYYYY') AND TO_DATE('01012021','MMDDYYYY')    AND l.return_code = 1  GROUP BY TRUNC(date_added,'MM')  ORDER BY TRUNC(date_added,'MM');  

In addition to the count, per month, I want a column that is the average each month, of the total......not sure how to do this in the same query.

https://stackoverflow.com/questions/67011281/oracle-avg-count April 09, 2021 at 04:16AM

没有评论:

发表评论