SELECT reg_dt ,
cd ,
SUM(col_name) AS col_name,
SUM(SUM(col_name)) OVER(ORDER BY reg_dt ASC ROWS
BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
FROM
table_name
WHERE
cd = '053280'
GROUP BY cd,reg_dt
ORDER BY reg_dt
reg_dt cd col_name sum
=========================================
2020-08-18 08:31:54 053280 -293 -293
2020-08-18 08:38:25 053280 1 -292
2020-08-18 08:38:49 053280 5 -287
2020-08-18 09:00:18 053280 2719 2432
2020-08-18 09:00:22 053280 -20 2412
2020-08-18 09:00:54 053280 3000 5412
728x90
댓글