[thelist] (SQL) Count Distincts
Tab Alleman
Tab.Alleman at MetroGuide.com
Fri Jan 31 17:52:01 CST 2003
I am trying to get a count of Distinct IP's from my homemade hit-log
database (don't ask). The db is MySQL. I'm trying this:
SELECT DISTINCT ClientIP, COUNT(*), Month(TimeStamp),
DayOfMonth(TimeStamp) FROM RedirectLog WHERE (TimeStamp BETWEEN
'20030130000000' AND '20030131000000') GROUP BY Month(TimeStamp),
DayOfMonth(TimeStamp)
But it doesn't appear to be doing what I want. The Count per day is the
same as it was when I didn't have "DISTINCT ClientIP, " in there, and I
know from looking at the raw data that there are some duplicate
ClientIP's in the data. The MySQL docs don't have an example (that I
could find) of what I'm trying to do.
What am I doing wrong? (besides not getting enough sleep)
TIA,
Tab
More information about the thelist
mailing list