Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Windowing Function Range Between Dates

$
0
0
Hi,

How do I write an SQL that will give results based on a moving window based on a date range?
For e.g. in the following table
Code:

KeyCol AmtCol DateCol
1            10      2013-01-01
2            20      2013-02-01
3            30      2013-03-01
4            40      2013-04-01

for a given I want to produce the sum of AmtCol between the last month and the next following month.

Viewing all articles
Browse latest Browse all 13329

Trending Articles