If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Help converting query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-19-04, 15:41
pmcnally pmcnally is offline
Registered User
 
Join Date: Jul 2004
Posts: 1
Help converting query

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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On