select t.*, sum("In"-"Out") over(order by id) as balance
from tbl t
order by id
Violin: http://sqlfiddle.com/#!15/97dc5/2/0
Overvej at ændre dine kolonnenavne "In" / "Out", så du ikke behøver at sætte dem i anførselstegn. (De er reserverede ord)
Hvis du kun ville have én kunde (customer_id =2):
select t.*, sum("In"-"Out") over(order by id) as balance
from tbl t
where customer_id = 2
order by id
Hvis din forespørgsel skulle spænde over flere kunder, og du ønskede en løbende saldo, der GENSTARTEDE hos hver kunde, kunne du bruge:
select t.*, sum("In"-"Out") over( partition by customer_id
order by customer_id, id ) as balance_by_cust
from tbl t
order by customer_id, id