title: Convert mysql field value from varchar to int and make comparison in query
body: <p>i have a varchar field in the database that stores years in format like : 2004,2005,2006 etc... How can i convert the varchar format to int and put condition to it in  the where clause so i can get for example only years bigger than 2005  ? </p>
  
  <p>I tried this </p>
  
  <pre><code>$sql = "select t1.* from table1 t1 left join table2 t2 on t1._id = t2.id where t2.version='year' and t1.field='name' and COVERT(t1.value, UNSIGNED) &gt; 2005";
  </code></pre>
  
  <p>But it did not work. Thanks.</p>