| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Grouping query by day using a timestamp|
Right now it groups it by second.
Hello, I'm trying to gather some information from my database but I need to group it by the day.
I have a timestamp in my database called "created" in the format of yyyy-mm-dd hh:mm:ss.
Right now if I group by created, its grouping my users all the way down to the second. Is it possible to make my grouping by day?
Also, how might I make sure that my user counts are sorted by the creation date, where the most recent day is listed first?
$query=mysql_query("SELECT COUNT(users) FROM database GROUP BY created");
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved