title: Get only latest records of each ID in PostgreSQL
body: <p>I have two tables
  accounts table</p>
  <pre class="lang-none prettyprint-override"><code>account_id    location_id
    1              11
    1              12
    2              21
    2              22
  </code></pre>
  <p>Events_table</p>
  <pre class="lang-none prettyprint-override"><code>location_id     events_id          event_date
     11              e1               2022/03/04
     11              e3               2022/03/05
     12              e2               2022/03/10
     21              e5               2022/04/10
     21              e2               2022/04/09
  </code></pre>
  <p>The result I expected is to get only latest event_id for  location with respect to account</p>
  <p>Result Expected:</p>
  <pre class="lang-none prettyprint-override"><code>account_id  location_id   events_id      event_date
    1              11          e3          2022/03/05
    1              12          e2          2022/03/10
    2              21          e5          2022/04/10
  </code></pre>