title: how to get count and percentage comparing two tables in mysql
body: <p>I have two tables one from last year and the current year one.</p>
  
  <p>I need to get the total count of each table then compare and get the percentage of last year count and then group them by ID.</p>
  
  <p>Table2012</p>
  
  <pre><code>ID  Cate
  1     a
  1     b
  1     c
  2     a
  2     b
  2     c
  3     c
  3     e
  </code></pre>
  
  <p>Table2013</p>
  
  <pre><code>ID   Cate
  1     a
  1     b
  2     a
  2     b
  2     c
  3     c
  3     e
  2     r
  2     t
  3     d
  3     g
  </code></pre>
  
  <p>Required Report Result</p>
  
  <pre><code>ID   total2012    total2013    percentage
  1       3              2            66%
  2       3              5           167%
  3       2              4           200%
  </code></pre>
  
  <p>Thank You in advance</p>
  
  <p>Jason</p>