title: Find diff between MySQL tables, only returning rows where a specific column has changed
body: <p>I need to diff two MysQL tables, and report on changes to a subset of the results.</p>
  
  <p>Let's say I have these two tables:</p>
  
  <p>Table A:</p>
  
  <pre><code>id      name        supplier        value
  -----------------------------------------
  1       Alice       X               100
  2       Bob         Y               200
  3       Clare       Z               300
  4       Desmond     X               400
  </code></pre>
  
  <p>Table B:</p>
  
  <pre><code>id      name        supplier        value
  -----------------------------------------
  1       Alice       X               150
  2       Bob         X               200
  3       Clare       Z               350
  4       Desmond     X               400
  5       Emily       X               500
  </code></pre>
  
  <p>I'm interested in changes to any row involving supplier X. Given the above, I want to return:</p>
  
  <ul>
  <li>ID 1, because the supplier is X and the value has changed;</li>
  <li>ID 2, because the supplier has changed from Y to X;</li>
  <li>ID 5, because the supplier is X and there's no corresponding row in table A.</li>
  </ul>
  
  <p>I'm not interested in ID 3 because, while the value has changed, the change doesn't involve supplier X. I'm also not interested
  in ID 4 because there is no change at all.</p>
  
  <hr>
  
  <p>I can use <code>UNION ALL</code> to compute the diff:</p>
  
  <pre><code>SELECT *
  FROM
   (
     SELECT a.id, a.name, a.supplier, a.value, 'a' as tbl
     FROM a
     UNION ALL
     SELECT b.id, b.name, b.supplier, b.value, 'b' as tbl
     FROM b
  )  t
  GROUP BY id, name, supplier, value
  HAVING COUNT(*) = 1
  ORDER BY id
  </code></pre>
  
  <p>This returns all rows where the data has changed:</p>
  
  <pre><code>id      name        supplier        value       tbl
  ---------------------------------------------------
  1       Alice       X               100         a
  1       Alice       X               150         b
  2       Bob         Y               200         a
  2       Bob         X               200         b
  3       Clare       Z               300         a
  3       Clare       Z               350         b
  5       Emily       X               500         b
  </code></pre>
  
  <p>However, it is also including ID 3 which I'm not interested in, because neither the row from table A or B has supplier X.</p>
  
  <p>So finally, my question is - <strong>how to return results where one of the diffed rows is supplier X</strong>? I could of course filter the results in code, but it would be great to do this in a single query.</p>