Groups | Blog | Home
all groups > sql server programming > october 2003 >

sql server programming : Re: SP or Query needed...



oj
10/27/2003 11:37:53 PM
This will give you float values...

select data,value1,
value2=(select sum(value1) from (select top 3 value1 from tst t2 where
t2.data<=t1.data order by data desc)x having count(*)=3)/3.,
value3=(select sum(value1) from (select top 6 value1 from tst t2 where
t2.data<=t1.data order by data desc)x having count(*)=6)/6.
from tst t1

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net



GB
10/28/2003 5:12:54 PM
Thank you!

GB


[quoted text, click to view]

AddThis Social Bookmark Button