MySQL Forums
Forum List  »  PHP

Calculating Columns
Posted by: B R
Date: April 23, 2020 09:19PM

I have a transactions table with a credit and debit column. (Don't worry I'm not trying to be a bank, it's a small reward program).

Is it possible or how can I in one query calculate all credits and all debits then work out the difference?

I know how to do SELECT SUM(Credit) as SumTotal etc but not sure how I can get a balance total in a single command.

Options: ReplyQuote

Written By
Calculating Columns
April 23, 2020 09:19PM
April 27, 2020 03:27PM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.