Skip to content
Advertisement

Tag: subtraction

Performing subtraction in SQL/finding the balance

SQL table here: http://sqlfiddle.com/#!9/abe1da/9 Current Table: Year Month Type Accounts Amount 2021 1 Actual abc 20 2021 1 Actual def 30 2021 1 Actual ghi 40 2021 1 Actual X 7 2021 1 Actual Y 3 2021 1 Actual final 105 Expected Year Month Type Accounts Amount 2021 1 Actual abc 20 2021 1 Actual def 30 2021 1 Actual

Calculating variances within a column

Note: 1st table is the current dataset, 2nd table is the requested result. I was thinking of creating temporary table X and Y which has sales and Sales&Service values data respectively and calculate the variance using a join. I was wondering if that’s the right/convenient way to solve this? Answer I think you just want conditional aggregation: If you want

Subtract values from the same Column in sql? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 2 years ago. Improve this question

Advertisement