"What we need is to take those account numbers with at least three months worth of account history (the last three months worth) - So 3 rows with the same account_number.
We want to end up with a table containing an account number and the account_balance average for the last 3 months for that account number.
We don't want accounts with less than three months, and we don't want to sum up more than three months worth even if they have more account history than that."
You can do it in ANALYTIC FUNCTION.
How ever, your requirement seems to be confusing.
Could you be more specific about your requirement? A sample report may help us.
Select Account_Number, Avg(Account_Balance)
From my_table
Where Date_Stamp > sysdate-90 --< fix this accordingly ! ! !
Group By Account_Number
Having Count(Account_Number) = 3;
Bookmarks