Grouping doesn't really make a difference in terms of the query results. I think it will have to be within the PHP code that gets me what I want, but I just can't wrap my head around how to do it. It's probably the simplest thing too!
UPDATE: Been working on it a bit more and have got closer, but still not quite right. Firstly, I discovered that I was sorting my query wrong, so I changed it to the following:
$dsql = "SELECT DATE_FORMAT(dates_time,'%b') AS 'month',
DATE_FORMAT(dates_time,'%e') AS 'day',
DATE_FORMAT(dates_time,'%l:%i %p') AS 'time'
FROM dates
WHERE dates.dates_events_id = 11
ORDER BY DATE_FORMAT(dates_time, '%H') DESC,
DATE_FORMAT(dates_time,'%m'),
DATE_FORMAT(dates_time,'%d')
Then I did the following php, which got me mostly what I wanted, though there's possibly an easier way to do this:
$dresult = dbquery($dsql);
$last_time = "";
$last_month = "";
$cur = 1;
while ($ddata = dbarray($dresult)) {
if ($ddata['time'] != $last_time) {
if ($cur != 1) {
echo "<br />\n";
}
echo $ddata['time'] . ": ";
$last_time = $ddata['time'];
$cur3 = 1;
}
if ($ddata['month'] != $last_month) {
if ($cur3 != 1) {
echo ", ";
}
echo $ddata['month'] . " ";
$last_month = $ddata['month'];
$cur2 = 1;
}
if ($cur2 != 1) {
echo ", ";
}
echo $ddata['day'];
$cur++;
$cur2++;
$cur3++;
}
Which produced this:
8:00 PM: Aug 29, 30, Sep 5, 12, 13, 19, 20
2:00 PM: Aug 31, Sep 7, 14
I'd still rather have the time at the end of the line, instead of the beginning, but I am at a loss and this will do for now. But any suggestions would be welcome!