Why aren't my MySQL Group By Hours vs Half Hours files Not displaying same data?
- by stogdilla
I need to be able to display data that I have in 15 minute increments in different display types. I have two queries that are giving me trouble. One shows data by half an hour, the other shows data by hour. The only issue is that the data totals change between queries. It's not counting the data that happens between the time frames, only AT the time frames.
Ex:
There are 5 things that happen at 7:15am. 2 that happen at 7:30am and 4 that show at 7:00am.
The 15 minute view displays all of the data.
The half hour view displays the data from 7:00am and from 7:30am but ignores the 7:15am.
The hour display only shows the 7:00am data
Here are my queries:
$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start),floor(minute(start)/30)";
and
$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start) ";
How can I pull out the data in groups like I have but get all the data included?
Is the issue the way the data is stored in the mysql table? Currently I have a column with dates (2010-03-29) and a column with times (00:00) Do I need to convert these into something else?