GROUP BY multiple columns
I prefer to take advantage of the 'string' format of dates:
LEFT(datestamp, 4) is the same as YEAR(datestamp), etc:

mysql&gt; SELECT LEFT(NOW(), 4), LEFT(NOW(), 7), LEFT(NOW(), 10);
+----------------+----------------+-----------------+
| LEFT(NOW(), 4) | LEFT(NOW(), 7) | LEFT(NOW(), 10) |
+----------------+----------------+-----------------+
| 2015           | 2015-02        | 2015-02-15      |
+----------------+----------------+-----------------+


So, your complex CASE boils down to deciding between 4, 7, and 10, thereby shortening the code significantly.  (This trick works for DATE, DATETIME, TIMESTAMP, but not timestamps stored as INT.)

As a side note: It would be better to use country CHAR(2) CHARSET ascii, which takes only 2 bytes.