title: select details of max(billdate) in postgres
body: <p>I want to get billmonth of maximum billdate in a financial year of each institutions in an office</p>
  
  <pre><code>SELECT i.institution_code, 
         bill_month 
  FROM   pfmast_institution i 
         LEFT JOIN pf_bills b 
                ON i.institution_code = b.institution_code 
                   AND fin_year = '2008-09' 
                   AND aproved = 'Y' 
  WHERE  institution_dd_officecode = '1005' 
  GROUP  BY i.institution_code, 
            bill_month 
  ORDER  BY Max(bill_date), 
            i.institution_code DESC 
  </code></pre>
  
  <p>Here the query is showing bill month of maximum billdate in each month.But I want billmonth of maximum billdate in each institution in a financial year.</p>