title: How to update and select a row within one query in SqLite?
body: <p>I want to update and select one row within one query in SqLite. In MySql my wanted query would look like this:</p>
  
  <pre><code>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;"
  </code></pre>
  
  <p>The above query will set the <em>Status</em> to 'running' and the value of the variable <em>@update_id</em> to the <em>Id</em> of the modified row for the first row that is having <em>Status</em> of 'scheduled' and than uses the variable <em>@update_id</em> to fetch the complete modified row.</p>
  
  <p><strong>The important point is that I need to select the row that I had been modified by the UPDATE statement</strong></p>
  
  <p>But as far as I know SqLite does not support variables.</p>
  
  <p>How can the MySQL query from above be rewritten for SqLite?</p>