[Solved] How to compare the current row to the next row of a mysql table in php


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`;

7

solved How to compare the current row to the next row of a mysql table in php