Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 21st, 2003, 02:42 AM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 7Day Moving Average

:):):):)

Good Day,

I wonder if anyone could advise me on this. My statistical Oracle DB stores hourly values only, so a Query for a Metric(C1055) Daily value looks like this:
SELECT
  CGSP.DW_STAT_CELL_DIM.CELL_NAME,
  CGSP.DW_DATE_DIM.EVENT_DATE,
  SUM(CGSP.DW_NORTEL_CELL_FACTS.C1055)
FROM
  CGSP.DW_STAT_CELL_DIM,
  CGSP.DW_DATE_DIM,
  CGSP.DW_NORTEL_CELL_FACTS
WHERE
  ( CGSP.DW_STAT_CELL_DIM.CELL_KEY=CGSP.DW_NORTEL_CELL _FACTS.CELL_KEY )
  AND ( CGSP.DW_DATE_DIM.DATE_KEY=CGSP.DW_NORTEL_CELL_FACT S.DATE_KEY )
  AND (
  CGSP.DW_STAT_CELL_DIM.CELL_NAME = 'CXC012'
  AND CGSP.DW_DATE_DIM.EVENT_DATE = {d '2003-11-14'}
  )
GROUP BY
CGSP.DW_STAT_CELL_DIM.CELL_NAME,
CGSP.DW_DATE_DIM.EVENT_DATE

The Question: How to modify this to obtain one extra column showing a "Moving 7 Day Average" for C1055

whith a condition such as: EVENT_DATE BETWEEN SYSDATE-12 AND SYSDATE-5, for example.

Please help,

Gezza



N/A





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining the average of multiple rows into one Saidar SQL Server 2005 2 December 24th, 2007 03:45 AM
Getting an average using SQL vs VBScript mat41 Classic ASP Professional 1 November 1st, 2007 06:33 PM
How to average a series of integers using assembly smithyluke Assembly Language 0 October 9th, 2007 12:42 AM
Find average for values stored in an array ja8261 VB.NET 2002/2003 Basics 2 October 29th, 2004 10:05 AM
find the average value from a column of values codespike Classic ASP Basics 2 August 15th, 2003 07:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.