Голосование за лучший ответ
Сергей Кременцов
Ученик
(169)
6 месяцев назад
Скорее всего ответ будет таким:
SELECT
company,
time_out,
TIMEDIFF(
time_out,
FIRST_VALUE(time_out) OVER (
PARTITION BY company ORDER BY time_out
ROWS BETWEEN 1 PRECEDING AND CURRENT ROW
)
) AS time_diff
FROM Trip
Victor Leonov
Ученик
(116)
4 месяца назад
SELECT
company,
time_out,
TIMEDIFF(
time_out,
FIRST_VALUE(time_out) OVER (
PARTITION BY company ORDER BY time_out
ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
) AS time_diff
FROM Trip
SELECT company, time_out,
TIMEDIFF( time_out, FIRST_VALUE(time_out) OVER ( -- ... ) ) AS time_diff
FROM Trip