with cte as (
Select 1 as order_num, 'Audi' as car, 7 as total_minutes, null as start_time, null as end_time
union all
Select 2 as order_num, 'BMW' as car, 15 as total_minutes, null as start_time, null as end_time
union all
Select 3 as order_num, 'Mercedes' as car, 5 as total_minutes, null as start_time, null as end_time
)
Select * from cte order by order_num
Как заполнить start_time и end_time в запросе, например. Начало всегда 06:00 для order_num = 1 end_time: 06:00 + 7 = 06:07 .... Начало второй строки в 06:07 ......
Это нужно как вывод:
1 Audi 7 06:00 06:07
2 BMW 15 06:07 06:22
3 Mercedes 5 06:22 06:27