View Full Version : Query help
filburt1
03 Apr 2004, 16:49
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
How would I do this?
Why not do your calculations outside of the query using PHP - makes for faster processing time :)
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
that should work i think
filburt1
03 Apr 2004, 19:46
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
that should work i think
Close, got it working with this, thanks:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
oops, i forgot that you ahve a special col with the ammount ;)
vBulletin® v3.6.12, Copyright ©2000-2013, Jelsoft Enterprises Ltd.