Zkuste to s tímto:
SELECT
ID,
`time` AS time1,
(SELECT MIN(st.`time`) FROM T1 st WHERE st.ID = T1.ID AND st.`time` > T1.`time`) AS time2
FROM T1
Zkuste to s tímto:
SELECT
ID,
`time` AS time1,
(SELECT MIN(st.`time`) FROM T1 st WHERE st.ID = T1.ID AND st.`time` > T1.`time`) AS time2
FROM T1