2 ms·
with allTimes as ( with startTimes as ( select distinct start_time from meetings ), endTimes as ( select
by chupa-chups 7y ago
with allTimes as (
with
startTimes as (
select distinct start_time
from meetings
),
endTimes as (
select distinct end_time
from meetings
)
select start_time as pointInTime from startTimes
union select end_time as pointInTime from endTimes
)
select tt.pointInTime, count(*) from meetings mm
inner join allTimes tt on (
mm.start_time <= tt.pointInTime
and mm.end_time > tt.pointInTime)
group by tt.pointInTime
order by tt.pointInTime
(no idea if this is totally correct, just hacked together in a few minutes (postgresql))