Skip to content
Advertisement

SQLite How to calculate a difference between two variables of the same table [closed]

I am pretty new to SQL and I can’t figure out how to sum the amounts (in_amount – out_amount) per asset in the pantry considering the following table. Table

Ideally I would get this result table (calculation between parentheses for clarification) Thanks for your help!

Advertisement

Answer

This looks like union all to unpivot, then aggregation:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement