SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Group-By Across 2 Columns


Group-By Across 2 Columns

Author
Message
ftonyan
ftonyan
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 12
Hi Thanks in advance for helping. Sorry if posted in the wrong place. I am new to the board.

I have the following table:

create table temp_vol (symbol nchar(10), dseqkey int, volume float)

here are some values in the table:
symbol dseqkey volume (no commas in the actual values)
C 20672 422,764,512
F 20672 47,144,600
F 20671 51,695,000
C 20671 371,950,496
F 20670 48,680,600
C 20670 654,208,512
C 20669 626,121,600
F 20669 93,489,504
C 20668 712,674,304

The output I am seeking is a 2-day simple moving average ((volume dseqkey + volume dseqkey-1) / 2) for each symbol, for each dseqkey. I can get the moving average working for all symbols across one dseqkey. I can get the moving average working for all dseqkeys across 1 symbol. I cannot seem to get both working together.

Thx again
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search