I have a table with two columns: date
and price
. They both aren't unique.
I need to get running total in unique date order (one date - values sum for this date, next date - next sum + previous one and so on).
I know how to do this with subquery, but I want to use window functions:
There is a simple query:
SELECT f.date, SUM(f.price) OVER () FROM f GROUP BY f.date
It returns the error:
column
f.price
must appear in theGROUP BY
clause or be used in an aggregate function
But I've already used aggregate function (SUM
).
Can somebody tell me why this happend?