title: How Hive ql do query with multiple COUNT function and make a divides methon with them
body: <p>Here my question:
  I have a table with some records like (name, date, type). Suppose I have three type a, b and c.Now I want to count each type as type_count with some restriction and make a division with count(a)/count(b) to make a percent result, and the restriction in a and are different, how can I deal with this? thanks! my code look like this:</p>
  
  <pre><code>   SELECT name, count(a), count(a)/count(b)
     from table
     where ...
  </code></pre>
  
  <p>Is it possible to make some subquery in select? look like this</p>
  
  <pre><code>select name, count(a), count(a)/ (select count(b) from table where restriction_for_b)
  from table
  where retriction_for_a
  </code></pre>