 <p>Why not design your date column as date ?</p> <p>If you want to keep your current design, try this:</p> <pre><code>SELECT * FROM tbl_produce WHERE status = 0 AND concat(years, if(months &gt; 9, months, concat('0', months))) BETWEEN '201512' AND '201608' </code></pre> <p>OR</p> <pre><code>SELECT * FROM tbl_produce WHERE status = 0 AND ( (years = 2015 AND months = 12) OR (years = 2016 AND months &lt; 9) ) </code></pre>