Good evening skunks,
I am retrieving the data below from a MySQL table, I want to display it on a page as follows: for any given day, I want to show the earliest time and the latest time, (for example, 2010-02-02 09:53:00 and 2010-02-02 10:50:00) on one row.
In cases where there is only one entry for a given day ( for example 2010-02-01 08:55:00), I will show that entry as both the earliest time and the latest time, still on one row
I am sure I can write more than one query which can use MIN() and MAX() and subqueries to retrieve the same, but I want to run the query once, retrieve all the data then apply logic in code to achieve the same.
I had written some PHP code which works only until it encounters single entries but its too messy to post here, someone please help?
2010-02-01 08:55:00
2010-02-02 09:53:00
2010-02-02 09:54:00
2010-02-02 10:48:00
2010-02-02 10:50:00
2010-02-04 16:55:00
2010-02-05 17:29:00
2010-02-16 09:35:00
2010-02-16 18:10:00
2010-02-17 10:09:00
2010-02-18 11:28:00
2010-02-18 14:58:00
2010-02-19 09:31:00
2010-02-19 12:28:00
2010-02-19 12:33:00
2010-02-19 16:58:00
2010-02-22 09:40:00
2010-02-22 15:26:00
2010-02-22 15:31:00
2010-02-23 11:52:00
2010-02-24 10:41:00
2010-02-24 18:32:00
2010-02-25 11:38:00
2010-02-25 18:08:00
2010-02-26 11:00:00
2010-02-26 18:20:00