title: MYsql union with exists statement
body: <p>So i've got a fairly complicated sql statement merging ten tables into one table based on requirements.</p>
  
  <p>A sample of the results (only consists of the essential required for this question)</p>
  
  <pre><code>Unique | date | amount | Table
  12345  | 10/2 | 200    |   1
  12345  | 10/2 |  20    |   2
  23456  | 10/3 | 100    |   3
  </code></pre>
  
  <p>My question is, since the unique is the same for the first 2 rows, but from different tables, how can i merge them together so it becomes this?</p>
  
  <pre><code>Unique | date | amount | Table
  12345  | 10/2 | 220    |   1 (Don't really care about the table number)
  23456  | 10/3 | 100    |   3
  </code></pre>
  
  <p>This is a sample of my statement</p>
  
  <pre><code>(SELECT unique, dates, amt, tbl FROM ..... WHERE ....) 
  UNION 
  (SELECT unique, dates, amt, tbl FROM ..... WHERE ....) ORDER BY dates ASC
  </code></pre>
  
  <p>Would be great if it could be done via MYsql, if not, answers in PHP / VB.net would also be accepted. All help appreciated. Thanks</p>