title: Select All Rows From Union of Two Tables with Same Column
body: <p>I've read at least 10 SO questions on this topic and am not able to figure this out.  I'm working in Jupyter, but I don't think it makes a difference.</p>
  
  <p>I have two tables:</p>
  
  <pre><code>   Table A           Table B
  +-----+-----+     +-----+-----+
  |  x  |  y  |     |  x  |  y  |
  +-----+-----+     +-----+-----+
  |  1  |  2  |     |  1  |  3  |
  |  2  |  3  |     |  4  |  6  |
  |  3  |  4  |     |  7  |  9  |
  |  4  |  5  |     |  10 |  12 |
  |  5  |  6  |     +-----+-----+
  +-----+-----+
  </code></pre>
  
  <p>I'm able to take the union of these tables with the following query:</p>
  
  <pre><code>SELECT * FROM (
      SELECT * FROM A UNION SELECT * FROM B
  )
  </code></pre>
  
  <p>However, I'm not sure how to go about returning the four rows that have duplicate <code>x</code> columns from this union.  I've tried <code>GROUP BY x HAVING COUNT(*) &gt; 1</code>, but this only returns 2 rows.  The output should be:</p>
  
  <pre><code>+-----+-----+
  |  x  |  y  |
  +-----+-----+
  |  1  |  2  |
  |  1  |  3  |
  |  4  |  5  |
  |  4  |  6  |
  +-----+-----+
  </code></pre>