title: How to compare two dates in MySQL query?
body: <p>I want to compare two date in sql statement like following:</p>
  
  <pre><code>$before_5_days = date("d.m.Y", strtotime( '-5 days' ) );
  $GLOBALS['db']-&gt;query("DELETE FROM matches_of_comments WHERE flag=1 AND match_date &gt;'$before_5_days'");
  </code></pre>
  
  <p>the above query delete wrong fields.</p>
  
  <p>the match_date column is in varchar and i can not change it , i want to compare it with $before_5_days in the same format . is there any function like "strtotime" that could be used in the query to change the type of the match_date and make the comparison??? </p>