title: SQL Grand Total Column using Over()
body: <p>I would like to use grand total using over() function however it causes problems when the count(<em>) = 0.  It actually adds them to the total.  The real count is 138 not 141.  How can I fix this with keeping the counts(</em>) = 0 rows?</p>
  
  <pre><code>select
  count(*) cnt,
  sum(count(*)) over () grand_total,
  count(*)/cast(sum(count(*)) over () as float) percentage
  from 
  some_table
  </code></pre>
  
  <p>Data (6 rows returned)<br></p>
  
  <p>4, 141, .03<br>
  116, 141, .82<br>
  18, 141, .13<br>
  0, 141, .01<br>
  0, 141, .01<br>
  0, 141, .01<br></p>