title: How to get percentage value upto two decimal points in PostgreSQL?
body: <p>I have written following query to get the count and percentage value for individual user:</p>
  
  <pre><code>select a.user_type,a.count,a.count * 100/(select sum(sessions) from user_type) as percentage
  from
  (select user_type, sum(sessions) as count 
  from user_type 
  group by user_type
  order by user_type)  a,
  (select user_type, sum(sessions) as count 
  from user_type 
  group by user_type
  order by user_type)  b
  where a.user_type = b.user_type and a.count = b.count
  group by a.user_type,a.count
  </code></pre>
  
  <p>The percentage values are coming like 7.35684648. Can someone tell me what changes shall I do to get the % value as per my requirement.</p>