title: Swap column value with the same column of another record
body: <p>I have this fairly straightforward table with <code>ID</code>, <code>Position</code>, <code>Name</code> columns.</p>
  
  <pre><code>ID  Position  Name
  1   1         RecordX
  2   3         RecordY
  3   2         RecordZ
  </code></pre>
  
  <p>The <code>Position</code> column serves as an index for displaying the records in a user defined order, it should be unique, can not be lower than 1 and not be higher than the number of records in the table, in this case 3. The column doesn't enforce uniqueness so temporarily there can be 2 records with the same <code>Position</code>, but eventually no two records should have the same position for the correct working of the program.
  Currently, in order to swap the position of two records I need to do 3 queries, namely: </p>
  
  <ol>
  <li><p>find the other record's <code>ID</code> </p></li>
  <li><p>update the current record's <code>Position</code> to match the other record's <code>Position</code> </p></li>
  <li><p>update the other record's <code>Position</code> by it's previously found <code>ID</code> (Since momentarily there will be two records with the same <code>Position</code>, updating by <code>Position</code> is not possible.</p></li>
  </ol>
  
  <p>I feel there should be a way to do this with less rounds to the database, and thus with less than 3 queries. How should I approach this problem? </p>