I have this small problem, let's say I have a DB like this
|=user=|=week=|=points=|
| 1 | 1 | 10 |
| 1 | 2 | 14 |
| 3 | 1 | 1 |
| 2 | 3 | 4 |
| 4 | 4 | 1 |
| 3 | 1 | 1 |
and then with each week, every week for everyone must decrease by one point, so the following week it would run a query
UPDATE `userpoints` SET `points = (`points`-1)
resulting in:
|=user=|=week=|=points=|
| 1 | 1 | 9 |
| 1 | 2 | 13 |
| 3 | 1 | 0 |
| 2 | 3 | 3 |
| 4 | 4 | 0 |
| 3 | 1 | 0 |
it obviusly works, but then I have all those useless entries with zero points, so I have to run a delete after.
DELETE FROM `userpoints` WHERE `points` <= 0
so, would it be possible to run a query that would update the table, and also delete the unwanted entries in the process?