Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 average the three Next records.

Author  Topic 

QAZAFI
Yak Posting Veteran

50 Posts

Posted - 2009-07-29 : 17:49:36
Hi There
is there any way I can take the average of next three records avery time in the table. for example i have a table
CREATE TABLE #MyTable
( ID int NOT NULL,
Number int NOT NULL
)
INSERT #MyTable(ID, Number)
SELECT 1, 1 UNION ALL
SELECT 2, 3 UNION ALL
SELECT 3, 2 UNION ALL
SELECT 4, 4 UNION ALL
SELECT 5, 6 UNION ALL
SELECT 6, 8 UNION ALL
SELECT 7, 10
I am expecting result
as
ID Avearge
1 2
2 3
3 4 and so on
is any body have any idea how can I do this with out using cursors
Many thanks
Qazafi

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-29 : 18:07:30
Cross post. Continue here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=130283



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -