title: SQL Count(*) on multiple tables
body: <p>I am writing a horse racing web app and i have a stats page. What i am trying to do is show how many winners there are from each year.</p>
  
  <p>Currently i have this:</p>
  
  <pre><code>SELECT `Horse Number`, Count(*) AS `Total Winners`
  FROM `races`.`2009`
  WHERE `Win $`&gt;0 
  GROUP BY `Horse Number`
  ORDER BY Count(*) DESC;
  </code></pre>
  
  <p>It works like a charm and returns the following</p>
  
  <pre><code>Horse Number | Total Winners
  1|48
  2|49
  3|39
  4|31
  5|26
  6|31
  7|21
  8|25
  9|31
  10|16
  11|16
  12|20
  13|9
  14|8
  15|6
  16|3
  17|3
  18|2
  19|2
  </code></pre>
  
  <p>I have now created a table for 2010 and i am wanting SQL to return something similar but i want it to search over 2009 and 2010 at the same time.
  I thought something like this might do the trick.</p>
  
  <pre><code>SELECT `Horse Number`, Count(*) AS `Total Winners`
  FROM `races`.`2009`
  WHERE `Win $`&gt;0 
  GROUP BY `Horse Number`
  UNION
  SELECT `Horse Number`, Count(*) AS `Total Winners`
  FROM `races`.`2010`
  WHERE `Win $`&gt;0 
  GROUP BY `Horse Number`
  ORDER BY Count(*) DESC;
  </code></pre>
  
  <p>But it is just returning extra results at the bottom of the table so i now have 2 rows for each horse like this</p>
  
  <pre><code>Horse Number | Total Winners
  1|48
  2|49
  3|39
  4|31
  5|26
  6|31
  7|21
  8|25
  9|31
  10|16
  11|16
  12|20
  13|9
  14|8
  15|6
  16|3
  17|3
  18|2
  19|2
  1|0
  2|0
  3|0
  4|0
  5|0
  6|0
  7|0
  8|0
  9|0
  10|0
  11|0
  12|0
  13|0
  14|0
  15|0
  16|0
  17|0
  18|0
  19|0
  </code></pre>
  
  <p>Is anyone able to assist me please</p>
  
  <p>Thanks</p>