select id,
date,
amount,
running_total
from (
select id,
date,
amount,
sum(amount) over (order by date asc) as running_total
from transactions
) t
where running_total <= 6
select id,
date,
amount,
running_total
from (
select id,
date,
amount,
sum(amount) over (order by date asc) as running_total
from transactions
) t
where running_total <= 6