title: BigQuery: Divided by sum of values in column to find the ratio
body: <p>I have a simple table with two columns <code>Bin_name</code> (int) and <code>Count_in_this_bin</code> (int)</p>
  
  <p>I want to convert it to the ratio of each bin to the total count in all bins.</p>
  
  <p>I used the following query in Google BigQuery:</p>
  
  <pre><code>SELECT count_in_bin/(SELECT SUM(count_in_bin) FROM [table])
  FROM [table]
  </code></pre>
  
  <p>Then I get </p>
  
  <blockquote>
    <p>error:Query Failed
    Error: Subselect not allowed in SELECT clause</p>
  </blockquote>
  
  <p>Can anyone let me now the correct way to do this kind of simple divide in BigQuery?</p>