title: How to pull data based on current and last update?
body: <p>Our data table looks like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Machine Name</th>
  <th>Lot Number</th>
  <th>Qty</th>
  <th>Load TxnDate</th>
  <th>Unload TxnDate</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>M123</td>
  <td>ABC</td>
  <td>500</td>
  <td>10/1/2020</td>
  <td>10/2/2020</td>
  </tr>
  <tr>
  <td>M741</td>
  <td>DEF</td>
  <td>325</td>
  <td>10/1/2020</td>
  <td></td>
  </tr>
  <tr>
  <td>M123</td>
  <td>ZZZ</td>
  <td>100</td>
  <td>10/5/2020</td>
  <td>10/7/2020</td>
  </tr>
  <tr>
  <td>M951</td>
  <td>AAA</td>
  <td>550</td>
  <td>10/5/2020</td>
  <td>10/9/2020</td>
  </tr>
  <tr>
  <td>M123</td>
  <td>BBB</td>
  <td>550</td>
  <td>10/7/2020</td>
  <td></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I need to create an SQL query that shows the currently loaded Lot number - Machines with no Unload TxnDate - and the last loaded Lot number based on the unload TxnDate.</p>
  <p>So in the example, when I run a query for <strong>M123</strong>, the result will show:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Machine Name</th>
  <th>Lot Number</th>
  <th>Qty</th>
  <th>Load TxnDate</th>
  <th>Unload TxnDate</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>M123</td>
  <td>ZZZ</td>
  <td>100</td>
  <td>10/5/2020</td>
  <td>10/7/2020</td>
  </tr>
  <tr>
  <td>M123</td>
  <td>BBB</td>
  <td>550</td>
  <td>10/7/2020</td>
  <td></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>As you can see although Machine Name has 3 records, the results only show the currently loaded and the last loaded. Is there anyway to replicate this? The Machine Name is dynamic, so my user can enter the Machine Name and see the results the machine based on the missing <strong>Unload TxnDate</strong> and the last <strong>Unload Txn Date</strong></p>