I want to do the following in one go:
SELECT * FROM jobs WHERE status='PENDING';
UPDATE jobs SET status='RUNNING' WHERE status='PENDING';
So get all pending jobs, then set them as 'RUNNING' immediately after.
The reason I don't want to do it one after the other in two statements is that jobs could be added to the jobs table as 'PENDING' after the SELECT but before the UPDATE so I'd end up setting jobs as RUNNING even though I haven't grabbed it while it was in it's PENDING state.
Is there anyway to do this in one? So I want the result from SELECT and the UPDATE to happen on the fly.
Thanks.