title: Calculating percentage in hive
body: <p>I am having a little trouble getting the percentage.</p>
  
  <pre><code>colA | cloB | colC
  4    |  a   |  y
  5    |  b   |  y
  7    |  a   |  n
  8    |  a   |  y
  ------------------
  Output:
  a 67%
  b 100%
  </code></pre>
  
  <p>I have to get the percentage of colC(all the 'y') for each letter in colB.</p>
  
  <p>I have been able to get both totals seperatly but can't seem to get the percentage to work.
  <br> Gets the total 'y' for a,b(colB);</p>
  
  <pre><code>SELECT colB, COUNT(*) FROM tbl WHERE colC = '"y"' GROUP BY colB;
  Output:
  a   2
  b   1
  </code></pre>
  
  <p>Gets totals overall total for colB</p>
  
  <pre><code>SELECT COUNT(colC) FROM tbl WHERE colC = '"y"';
  Output:
  4
  </code></pre>
  
  <p>Thanks in advance</p>