Hi all.
I have a table with a this records:

<!-- Table user_activity -->
        <date>2008-05-23 20:19:36</date>

I am trying to query the DB to get the total results of activity PER DAY. This is my query (which obviously doesn't work):

SELECT date, COUNT(*) FROM `user_activity` WHERE `event` LIKE "LOGIN" AND `date` LIKE "2008-05%" GROUP BY date

Since the date field has also a hour timestamp, I get thousands of results with count 1.
Is there any way to group the results only by the first 10 characters (and omit the time of day)?

MySQL has a DATE function to extract only the date from a DATETIME field. You should be able to use a query such as the following:

select DATE(date), count(*) from user_activity where event LIKE "LOGIN" group by DATE(date);

I hope that helps.

commented: helpful +5