title: Multi-level aggregation from a table
body: <p>I have a table metrics which has the following columns :</p>
  
  <pre>
  stage  name
  ---------------------
  new    member
  new    member
  old    member
  new    visitor
  old    visitor
  </pre>
  
  <p>Now I can find out how many new or old members are there by running a query like this :</p>
  
  <pre>
  select stage, count(*) from metrics where name = 'member' group by stage;
  </pre>
  
  <p>This will give me the following result:</p>
  
  <pre>
  stage count
  -----------
  new   2
  old   1
  </pre>
  
  <p>But along with this I want output like this :</p>
  
  <pre>
  total  stage count
  ------------------
  3     new    2
  3     old    1
  </pre>
  
  <p>Total is sum of all rows statisfying where clause above. How do I need to modify my previous query to get the result I need? Thanks.</p>