title: How to do percentage in Postgresql
body: <p>I'm trying to create a query. I have two tables </p>
  
  <ul>
  <li><code>customer</code> (<code>customer_id</code>)</li>
  <li><code>rental</code> (<code>rental_date</code> (timestamp), <code>customer_id</code>)</li>
  </ul>
  
  
  
  <pre><code>SELECT   to_char( rental_date, 'Month') AS month, 
           (count(Distinct customer.customer_id)/
             (count (distinct rental.customer_id) * 100) 
           ) AS percentage
  FROM RENTAL,customer
  GROUP BY month;
  </code></pre>
  
  <p>But the result is zero.</p>