sql - Finding simultaneous events in a database between times -


I have a database that stores phone call records. Each phone call record has a start time and an end time. I would like to know how to know if our phones are more than the number of phone lines available in the bank, what is the maximum amount of simultaneous phone calls, how can I go about solving this problem ?

Given the fact that the maximum number of connections going up is a starting point, you can

  CountSimultaneous to Phonecalls T1, Phone Call T2 WHERE T1 as Top 1 Count (*) Start time between T2.StartTime and T2 The different DESC calculated by the T1.EndTime group by the T1.CallID command  

will return the number of calls simultaneously for each call. Either order them to descend and select one or SELECT MAX (CountSimultaneous) from the top (without any command and without the top)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -