1 vote

How to deal with invoices that reference products that don't exist any more?

1: What is the best way to store data of a product in invoice? Is it by bringing the id of the product, or by bringing all info related to the product? Actually is it a good practice to store id of ...
user avatar
1 vote
Accepted

Get the difference for a column value by all its previous rows data

Something like this, may be? sum(case transaction_type when 'debit' then -1 else 1 end * amount) over (partition by vault_id order by id rows unbounded preceding and current row)
user avatar
  • 21.2k

Only top scored, non community-wiki answers of a minimum length are eligible