i have a sales 'table' and from it i have created a 'view' called dailyactivity which gives me the total sales made on each day. i am trying to add a cumulative frequency field but it returns an empty coloumn.can any one point me in the right direction.This is what i Have
This is what i would like
Query:
SELECT
d1.Date_TR,
sum(d1.Sales) AS Daily_Sales,
(SELECT SUM(d2.Sales)
FROM dailyactivity d2
WHERE d2.Date_TR <= d1.Date_TR) AS cumulative_sum
FROM dailyactivity d1
GROUP BY d1.Date_TR
ORDER BY d1.Date_TR ASC