php - How do you count the distinct values for each day using a timestamp column? -
i'm using mysql , i'm having trouble thinking of query count number of users/visitors date range. way i'm doing using php, select date range , process data in loop , count them there. it's pretty easy, problem method not work bigger data of few million rows. alternative count distinct values using mysql , return count , not actual data utilizing index on timestamp column. also, converting column datetime not option. ideas how can achieve this?
here's sample result set of need:
date | count 5-01-13 14 5-02-13 44 5-03-13 23 5-04-13 13
my problem don't know how group timestamp column day.
that should trick:
select date('datetimecolumn'), count(*) table group date('datetimecolumn')
Comments
Post a Comment