Forum Moderators: coopster

Message Too Old, No Replies

Query Grouping Similar values

Even though their unique

         

Willis

9:40 pm on Apr 27, 2004 (gmt 0)

10+ Year Member



If for some reason the link does not work, its cuz I'm not connected to the net.

<snip>

Observ the "Joined" Colum . . Now the first one says two, because I think thats the main admin and the defauly aynomous name created . . but otherwise everyones got their own row.

This I expected , because every timestamp is unique. Especialy considering my query meerly is this:

"SELECT `user_regdate`, COUNT(`user_regdate`) AS `hits` FROM `phpbb_users` GROUP BY `user_regdate`"

How can I group them on a larger scale? Say if I wanted to group by date, instead of:

Mar 30, '04 1

being said 4 times, it says:

Mar 30, '04 4

[edited by: jatar_k at 10:00 pm (utc) on April 27, 2004]
[edit reason] no personal urls thanks [/edit]

Netizen

10:06 pm on Apr 27, 2004 (gmt 0)

10+ Year Member



You should format the date and then group by that

SELECT date_format(regdate,'%Y-%m-%d') AS aDate,COUNT(*)
FROM mytable
GROUP BY aDate

should give you

2004-04-26, 4
2004-04-27, 2

etc

Willis

12:33 am on Apr 28, 2004 (gmt 0)

10+ Year Member



[edited by: jatar_k at 10:00 pm (utc) on April 27, 2004]
[edit reason] no personal urls thanks [/edit]

*shrugs* . .

Well OK . . I did some research and , realized what I should be trying is the same conecpt but instead of date_format , use FROM_UNIXTIME . Thanks non the less .