I am trying to convert this query to work with an older version of MySQL.

My host is running MySQL 3.22.32-log. This version does not support use of the keyword DISTINCT within the COUNT() function.

Can somebody tell me how to convert this query to work with my older version of MySQL? (possibly by making it into 2 queries)

SELECT YEAR(time_str),MONTH(time_str),DAYOFMONTH(time_str ),COUNT(*),COUNT(DISTINCT remote_host) FROM stats GROUP BY 1,2,3 ORDER BY 1,2,3;

The table is setup as follows

mysql> describe stats;
+-------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+-------+
| time_str | datetime | YES | | NULL | |
| remote_host | text | YES | | NULL | |
| request | text | YES | | NULL | |
| referer | text | YES | | NULL | |
| user_agent | text | YES | | NULL | |
+-------------+----------+------+-----+---------+-------+


Any help would be greatly appreciated =)

-Pat