4 ms·
A Cool SQL Problem (and Why It Is Also a Bullshit SQL Problem)
- chupa-chups 7y agowith 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))