title: How to compare two queries if they affect the same row?
body: <p>I have to check wether two queries (e.g. an update and a delete statement) affect the same row in a MySQL database.</p>
  
  <p>I thought about selecting the affected entries of the queries with a select and check if the same row appears in both queries:</p>
  
  <pre><code>UPDATE Foo SET col = 'a' WHERE id &gt; 5;
  DELETE FROM Foo WHERE col = 'b';
  
  SELECT (SELECT * FROM Foo WHERE col = 'b') IN (SELECT * FROM Foo WHERE id &gt; 5);
  </code></pre>
  
  <p>In practice it worked for my simple <code>Foo</code> table, but failed in another table with several columns - even when the two sub-selects where exactly the same. Also with this solution the first sub-select can only contain one result.</p>
  
  <p>Does anyone know another solution or the reason why the above select could fail with another table?</p>