I am not sure if this is doable, i have a table of data with timestamp
e.g.
apple 2013-01-02 06:24:22
banana 2013-01-12 11:08:22
apple 2013-01-02 15:24:22
apple 2013-01-02 12:30:16
banana 2013-01-14 18:34:22
i want to:
- rearrange the data base on distinct date not timetamp, means all same date will group together
if possible i hope to achieve the below in final result
apple 2013-01-02 06:24:22 2013-01-02 15:24:22 // get first and last data banana 2013-01-12 11:08:22 2013-01-12 11:08:22 // only one data in the group banana 2013-01-14 18:34:22 2013-01-14 18:34:22 // only one data in the group
How can i do this with minimum sql queries instead of using a loop to determine?