I have a table with (for simplification) three columns: fromuserid, touserid, and amount. I want to find the sum of amount, but it is governed by the following (using 13 as a sample userid):
If touserid is 13, then add the amount to the sum
If fromuserid is 13, then subtract the amount from the sum