title: Max or Top1 with Format Function SQL
body: <p>Is there anyway I can include the Max or Top1 function into the below. </p>
  
  <p>I'm trying to return the latest date value however due to the database returning date &amp; time format I need to use the <code>FORMAT</code> syntax to correct this.</p>
  
  <p>I've tried in both the <code>SELECT</code> and <code>WHERE</code> clauses but can't get it to work</p>
  
  <pre><code>sSql = "SELECT FORMAT(Total.StockDate, 'dd/mm/yy' ) AS DateRev FROM " &amp; Mailbox &amp; Totals &amp; " WHERE(Total.UnitCode=" &amp; Sheets("Pipe Cleaning").Range("C4") &amp; " )"
  </code></pre>