Home » RDBMS Server » Server Administration » Re: How I can take avg of last 3 months
Re: How I can take avg of last 3 months [message #373198] Tue, 03 April 2001 22:49
Naresh
Messages: 27
Registered: March 2001
Junior Member
I need to slightly modify Madhav's statement,
well you cannot use 90 days as a value to
get the last 3 months, what if the month in
the range is Feb and its a Leap year.

Solution :

select avg(qty), part_no
from parts
where odate between add_months(sysdate,-3) and sysdate
group by part_no;

-------------------
Previous Topic: Re: Trigger
Next Topic: how to retrive data starts from Aa till Am from a table?
Goto Forum:
  


Current Time: Mon Dec 23 05:26:32 CST 2024