I have a table with these 3 columns:
- task (string)
- status (string)
- date (datetime)
I want to write a query that does the following:
- Selects the first row
WHERE status != "In-Progress"Sorted by Date (oldest first), and Locks it – so other computers running this query concurrently can’t read it.
- Updates the Status column so
status = "In-Progress".
- Return the row’s columns (like a regular
How do I write this query?
My main concern is that the row is only fetched by 1 computer, no matter how many concurrent instances are running.