Unix Technical Forum

Moving Average

This is a discussion on Moving Average within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I have a base table with the 2 columns, IMSI and Date. I would like to calculate a moving ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:17 AM
asif.shariff@gmail.com
 
Posts: n/a
Default Moving Average

I have a base table with the 2 columns, IMSI and Date. I would like to
calculate a moving average of distinct IMSIs in a given window. I have
developed my query to this point but am receiving an "ORDER BY not
allowed here" error when I try to execute the query.

select ir_date, count(distinct imsi) OVER (ORDER BY ir_date ASC RANGE 5
PRECEDING)
from ir_daily_unique
where ir_date between to_date('03-AUG-06','DD-MON-YY') and
to_date('15-AUG-06','DD-MON-YY')
group by ir_date

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:19 AM
joel garry
 
Posts: n/a
Default Re: Moving Average


asif.shariff@gmail.com wrote:
> I have a base table with the 2 columns, IMSI and Date. I would like to
> calculate a moving average of distinct IMSIs in a given window. I have
> developed my query to this point but am receiving an "ORDER BY not
> allowed here" error when I try to execute the query.
>
> select ir_date, count(distinct imsi) OVER (ORDER BY ir_date ASC RANGE 5
> PRECEDING)
> from ir_daily_unique
> where ir_date between to_date('03-AUG-06','DD-MON-YY') and
> to_date('15-AUG-06','DD-MON-YY')
> group by ir_date


Does moving the order by next to the group by do what you want?

http://download-west.oracle.com/docs...2.htm#i2066419

More examples at
http://asktom.oracle.com/pls/ask/f?p...12864646978683

jg
--
@home.com is bogus.
http://www.explodingcigar.com/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com