title: How to modify SQL query to get latest date
body: <p>I need to obtain the latest order date in <code>statsbestproducts</code> module, I added it to the SQL query but I obtain the first order date (between two dates). How to change it for latest dates? And also how to remove the time from this date?</p>
  <p><img src="https://i.stack.imgur.com/x6Did.png" alt="screen" /></p>