[Solved] Why count yields different results using group by vs where?


Strings like ‘2018-01-31’ are considered ‘2018-01-31 00:00:00’ when used with datetime and timestamp values; so basically, you are not counting the last day of the time span with the latter query.

If you want to do the latter, it can be simpler to do:

where datehour >= '2018-01-01' and datehour < '2018-02-01'

4

solved Why count yields different results using group by vs where?