I want to update and select one row in one query in SqLite. In MySql, my query will 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 @update_id variable in the Id of the changed row for the first row that has the status of "scheduled", and uses the @update_id variable to retrieve the full changed row.
The important point is that I need to select the row that was modified by the UPDATE statement
But as far as I know, SqLite does not support variables.
How can I rewrite the MySQL query from above for SqLite?
source share