title: SQL to compare date in python
body: <p>I need to compare the user input date <code>kakko</code> (yyyy-mm-dd format) with the CreateDate and UpdateDate in table productinfo and return the result. </p>
  
  <p>This does not work. </p>
  
  <pre><code>cur.execute("SELECT * FROM `productinfo` WHERE CreateDate &gt; %s-%s-%s AND CreateDate &lt;= (SELECT MAX( UpdateDate ) FROM productinfo) AND Updatedate = (SELECT MAX( UpdateDate ) FROM productinfo) ",kakko)
  db.commit()
  </code></pre>