title: Get closest previous date T-SQL
body: <p>I need to get select the closest previous date to a date parameter. Currently I am selecting the closest either side of the date using this code:</p>
  
  <pre><code>SELECT TOP 1 equities, fund, e_date
          FROM tbl_assetmix
          WHERE fund = @fund_code
          ORDER BY ABS(DateDiff(dd, e_date, @statementdate)) asc
  </code></pre>
  
  <p>I know it is really simple but can someone suggest how I would be able to select the closest date prior to the @statementdate parameter?</p>
  
  <p>Thanks,
  Tristan</p>