title: SQL: How to select the oldest date row
body: <p>I have a report looks something like this :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">numberOrder</th>
  <th style="text-align: center;">timestamp</th>
  <th style="text-align: right;">id</th>
  <th style="text-align: right;">status</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">12</td>
  <td style="text-align: center;">2021-06-23-14.00.00.232425</td>
  <td style="text-align: right;">11</td>
  <td style="text-align: right;">done</td>
  </tr>
  <tr>
  <td style="text-align: left;">13</td>
  <td style="text-align: center;">2021-06-30-18.00.00.224525</td>
  <td style="text-align: right;">22</td>
  <td style="text-align: right;">done</td>
  </tr>
  <tr>
  <td style="text-align: left;">14</td>
  <td style="text-align: center;">2021-07-01-01.00.00.224525</td>
  <td style="text-align: right;">23</td>
  <td style="text-align: right;">done</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>This is done with SQL :</p>
  <pre><code>SELECT numberOrder, timestamp, id, status 
  from order 
  where status = 'done'
  </code></pre>
  <p>I would like the report to show just the oldest row :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">numberOrder</th>
  <th style="text-align: center;">timestamp</th>
  <th style="text-align: right;">id</th>
  <th style="text-align: right;">status</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">12</td>
  <td style="text-align: center;">2021-06-23-14.00.00.232425</td>
  <td style="text-align: right;">11</td>
  <td style="text-align: right;">done</td>
  </tr>
  </tbody>
  </table>
  </div>
  <pre><code>SELECT numberOrder, timestamp, id, status 
  from order 
  WHERE timestamp = (select TOP 1 timestamp FROM order by timestamp)
    and status = 'done'`
  </code></pre>
  <p>Any ideas ? I try to use min(). Any help is appreciated
  And have any ideas if I dont find any status done then find the status cancel ?</p>
  <p>I would like the report to show just the cancel row if we dont find any done status :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">numberOrder</th>
  <th style="text-align: center;">timestamp</th>
  <th style="text-align: right;">id</th>
  <th style="text-align: right;">status</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">12</td>
  <td style="text-align: center;">2021-06-23-14.00.00.232425</td>
  <td style="text-align: right;">11</td>
  <td style="text-align: right;">cancel</td>
  </tr>
  </tbody>
  </table>
  </div>