Okay, I've searched and can't find an answer to what is probably simple, but eluding me.
I have a table of virtual currency transactions. Some of them are purchasing virtual items and some are purchasing virtual currency (via real-money transactions). I would like to monitor the in-game transactions a player makes after making a real-money transaction.
Simple schema:
- userId
- timestamp
- transactionType (real-money or in-game)
- itemId (of the in-game item they bought)
- value (positive for real-money transactions that add to the user's balance, negative for in-game purchases)
- newBalance (the user's new currency balance)
It's easy enough to tally the purchases made within, say 10 minutes of purchase using a self-join. What I'd like to do is give each user a balance based on the value of the currency they purchased, then tally the purchases they made using that currency until that balance runs out.
I've got to think there's an easy way to do this using user-defined variables, but it's escaping me.
Thanks in advance!