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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -