このクエリを思いつきました - 複数の列の結果を 1 つに結合するにはどうすればよいですか?
select
R2.start_time,
TIME_FORMAT(time(R2.start_time - time(10000)),
'%H:%i:%s') as '-60min',
TIME_FORMAT(time(R2.start_time - time(3000)),
'%H:%i:%s') as '-30min',
TIME_FORMAT(time(R2.start_time + time(10000)) - time(3000),
'%H:%i:%s') as 30min,
TIME_FORMAT(time(R2.start_time + time(10000)),
'%H:%i:%s') as 60min
from
(select
rooms.id, rooms.number, rooms.building, rooms.capacity
from
rooms) R1,
(select
exam_schedules.room_id,
exam_schedules.day,
exam_schedules.start_time,
exam_schedules.end_time
from
exam_schedules) R2
where
R2.room_id = R1.id and R2.day = 'tuesday' AND R1.number = 006
group by 1
これは私の結果です:(1行)
12:30:00 11:30:00 12:00:00 13:00:00 13:30:00
(5 行):
12:30:00
11:30:00
12:00:00
13:00:00
13:30:00