如何将当前行与php中的mysql表的下一行进行比较

I want to compare the current row to the next to check if the third column of the current row is the same as to the next. If not, the current row index will adjust as the new current row and check again the next row. I want to do this in php. Can somebody help me.

UPDATED:

ID    |   Date    | Time
------+-----------+-------
00091 | 2015-1-20 | 08:05
00091 | 2015-1-20 | 17:10
00099 | 2015-1-20 | 07:45
00099 | 2015-1-20 | 17:42

my expected outputs are:

ID    |   Date    |    Time
------+-----------+-------------
00091 | 2015-1-20 | 08:05 17:10
00099 | 2015-1-20 | 07:45 17:42

This looks like a terrible database design, so I would highly recommend changing it! Having duplicate IDs hurts me deeply.

But, here's a MySQL query that could get the result you are after:

SELECT `ID`, `Date`, CONCAT(MIN(`Time`), ' ', MAX(`Time`)) AS `Time`
FROM `test`
GROUP BY `ID`, `Date`;