Hi. I have a MySQL database table
players with columns
id,
name and
points. I want to update points by incrementing them and select the affected row in one database request.
Example:
Code:
UPDATE players
SET points = points + 100
WHERE id = 1
LIMIT 1;
SELECT name, points
FROM players
WHERE id = 1
LIMIT 1;
I need it in one request, because there is an assumption, that tens of requests could run per second, so it needs to be really quick.
Is it possible to combine those queries into one, or is it possible to run them at once while still getting the result? If so, how to implement it with CodeIgniter 4, especially with query builder? Thank you for your tips.