title: Get the latest record in the table on a given day
body: <p>I have a table A with columns offer_id, item_id and report_date(not timestamp, just date)</p>
  
  <p>I want to get the latest record of offer_id for a particular item_id on that given date . Im using Presto db. Can anyone help?</p>
  
  <p>I tried something like below, but not sure if its right.Still learning.</p>
  
  <pre><code>select A.report_dt, A.offer_id, A.item_id
    from table A
   where A.rpt_dt = (select Max(rpt_dt)
                       from table
                      where item_id = A.item_id
                        and report_dt = date '2020-06-01')
   order by item_id;
  </code></pre>