Jump to content

Behaviour of COUNT


BenWeston

Recommended Posts

Hi all
 
I have a MySQL table of product reviews that, among others, has one TIMESTAMP column (date) with the date the review was left and another with a unique ID for the review (which I'm not currently using for this query as I don't think it's necessary?). I'd like to show reviews per day on a graph and am trying to get a list of dates with the number of reviews left on each one.
 
The following query isn't working and is returning some very odd numbers – what am I missing?

SELECT date, COUNT(*) AS graphcount FROM `reviews` GROUP BY DAY(date) ORDER BY date ASC

For example, this query is returning '18' against the date 2014-04-08 19:21:28, when it should be 2!

Link to comment
https://forums.phpfreaks.com/topic/287667-behaviour-of-count/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.