title: PHP/MySQL Sort By Date
body: <p>I'm trying to pull records out of my database based on the oldest date.</p>
  
  <p>The MySQl table looks like this:</p>
  
  <p>status, date, last, url </p>
  
  <p>1, 2010-12-30 17:59:54, 2011-01-03 06:26:04, site1.com</p>
  
  <p>1, 2010-12-28 12:16:10, 2011-01-03, 06:25:24, site2.com</p>
  
  <p>The date and last rows are datetime.</p>
  
  <p>Here are two types of queries I tried:</p>
  
  <pre><code>mysql_query("SELECT * FROM links WHERE status=1 ORDER BY last DESC LIMIT 0,25");
  mysql_query("SELECT * FROM links WHERE status=1 ORDER BY DATE(last) DESC LIMIT 0,25");
  </code></pre>
  
  <p>The query works for the most part but always leaves some of the oldest records out...</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you</p>