title: Max date and order by status exist at first occurrence if not found next value
body: <p>I have a table as below</p>
  <pre><code>ID,DATE,Status
  359,2021-05-01,M
  359,2021-05-01,R
  359,2021-04-01,M
  759,2021-05-01,R
  759,2021-04-01,O
  123,2021-05-01,M
  123,2021-04-01,O
  123,2021-03-31,U
  </code></pre>
  <p>and I want the result as below</p>
  <pre><code>359,2021-05-01,R
  759,2021-05-01,R
  123,2021-05-01,M
  </code></pre>
  <p>Date - Max/Latest date</p>
  <p>Status:</p>
  <ul>
  <li>First preference should be R(Exit if R found)</li>
  <li>If R doesn't exist then M</li>
  <li>If M doesn't exist then O</li>
  <li>If O doesn't exist then U etc.,</li>
  </ul>
  <p>Could someone please help me with this?</p>
  <p>Thanks in advance</p>