अपडेट किया गया क्या आप इसे ढूंढ रहे हैं?
CREATE VIEW vw_rain_stats
AS
SELECT TRUNC(rain_date, 'MM') rain_date,
SUM(amt) amt
FROM rain_stats
GROUP BY TRUNC(rain_date, 'MM')
;
2012 वर्ष के लिए मासिक राशि प्राप्त करें
SELECT rain_date,
amt,
SUM(amt) OVER (ORDER BY rain_date) running_amt
FROM vw_rain_stats
WHERE rain_date BETWEEN '01-JAN-12' AND '01-DEC-12';
दिसंबर 2011 से मासिक राशि प्राप्त करें
SELECT rain_date,
amt,
SUM(amt) OVER (ORDER BY rain_date) running_amt
FROM vw_rain_stats
WHERE rain_date >= '01-DEC-11';
नमूना आउटपुट:
| RAIN_DATE | AMT | RUNNING_AMT |
------------------------------------------
| December, 01 2011 | 80 | 80 |
| January, 01 2012 | 30 | 110 |
| February, 01 2012 | 70 | 180 |
| March, 01 2012 | 110 | 290 |
| .................. | ... | ........... |
यह रहा SQLFiddle डेमो