 <p>Consider the following query to solve your problem:</p> <pre><code>SELECT COUNT(*) AS `count` FROM test t WHERE `date` &lt; '2015-01-05' AND allocation = 'Same'; </code></pre> <p>Let's assume that the given date is '2015-01-05'. The idea here is to select all dates that are less than '2015-01-05' which means its previous days. Since allocation must be 'Same' so it's also included in condition section of statement.</p>