I want to update and select one row within one query in SqLite. In MySql my wanted query would look like this:
SET @update_id := -1;
UPDATE data SET `Status` = 'running', Id = (SELECT @update_id := Id)
WHERE `Status` = 'scheduled' LIMIT 1;
SELECT * FROM data WHERE id=@update_id;"
The above query will set the Status to 'running' and the value of the variable *@update_id* to the Id of the modified row for the first row that is having Status of 'scheduled' and than uses the variable *@update_id* to fetch the complete modified row.
The important point is that I need to select the row that I had been modified by the UPDATE statement
But as far as I know SqLite does not support variables.
How can the MySQL query from above be rewritten for SqLite?