title: Mysql Query to Merge 3 tables into 1 Table
body: <p>TO Plot Each Input table I have Separate query, need to apply functionality on that queries and want to create Single query  for Output Table</p>
  
  <p>Select Distinct Names, SUM(count) from 
  (Select Query  table 1 
  union 
  Select Query  table 2
  union
  Select Query  table 3) table group by Names;  </p>
  
  <p>this query Not adding count properly Niether Sorting Names properly Whats wrong with this ?  </p>
  
  <p>Input Table 1 :-  </p>
  
  <pre><code>    Names count  
      bob   3
      pol   4
  </code></pre>
  
  <p>Input Table 2 :-  </p>
  
  <pre><code>    Names count    
      bob   5  
            0      - name may be missing here neglect this entry  
  </code></pre>
  
  <p>Input Table 3 :-   </p>
  
  <pre><code>    Names count  
      james  4  
      pol    7  
      bob    1
  </code></pre>
  
  <p>Expected output table :-</p>
  
  <pre><code>    Names  count  
      bob    9  
      pol    11  
      james  4  
  </code></pre>