Entries count by date is giving wrong results I am getting some strange results with below queries:

SELECT count(id)
FROM `asins`
WHERE `StockUpdated` &gt;= '2016-12-30'
and  `StockUpdated` &lt;= '2016-12-31'


The result is : 24446

SELECT count(id)
FROM `asins`
WHERE `StockUpdated` &gt;= '2016-12-30'


The result is : 33098

SELECT count(id)
FROM `asins`
WHERE `StockUpdated` &gt;= '2016-12-30'
and `StockUpdated` &lt;= '2017-1-1'


The result is : 33098

SELECT count(id)
FROM `asins`
WHERE `StockUpdated` &gt;= '2017-1-1'


The result is : 0

My question is why the below query is not perfect?

SELECT count(id)
FROM `asins`
WHERE `StockUpdated` &gt;= '2016-12-30'
and  `StockUpdated` &lt;= '2016-12-31'
Looks like StockUpdated has a time part that makes the query not count the values on 2016-12-31 with time other than 00:00.

Try a non inclusive comparison instead. StockUpdated &lt; '2017-01-01'