> This is an approach I also considered, but hoped for a solution without the
> expense (albeit small) of having to create a function.
How about this query?
CREATE TABLE transactions (
item_code text,
_date date,
qty double precision
)
;
INSERT INTO transaction
David Johnston wrote
> Basic idea: use ORDER BY in the window to auto-define a range-preceding
> frame. Create an array of all dates (tags in the example) that match with
> positive amounts. Negative amounts get their matching tag added to the
> array as NULL. The provided function looks into th
gmb wrote
> item_code | _date| qty | max
> -
> ABC | 2013-04-05 | 10.00| 2013-04-05
> ABC | 2013-04-06 | 10.00| 2013-04-06
> ABC | 2013-04-06 | -2.00| 2013-04-06