Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2010
    Posts
    40

    Unanswered: help with identifying concurrent calls from call records

    Hi,
    I have a database with call records including start_time, end_time. What I want to do is process this data to identify calls that were in progress each minute.

    for example:
    |callid | start_time | end_time
    1 9:01:23 9:05:42
    2 8:42:22 10:03:11
    3 9:01:44 9:01:55


    so if i'm processing the minute
    • 9:00 - 9:01, I should see just the one call (id=3)
    • 9:01 - 9:02, I should see 3 calls (all ids)
    • 9:02 - 9:03, I should see 2 calls (ids=1,2)


    Any help is appreciated.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by dtrobert View Post
    so if i'm processing the minute
    • 9:00 - 9:01, I should see just the one call (id=3)
    • 9:01 - 9:02, I should see 3 calls (all ids)
    • 9:02 - 9:03, I should see 2 calls (ids=1,2)
    Example 1 should include id=2 as well, shouldn't it?
    Because call 2 was still in progress between 09:00 and 09:01

    And if the interval "09:01:44 - 09:01:55" (id=3) includes the "minute" from 09:00 to 09:01 then shouldn't the interval "09:01:23 09:05:42" (id=1) also include it?

    You should also clarify if by "9:00 - 9:01" you mean "09:00:00 - 09:01:00" or actually ""09:00:00 - 09:01:59"
    Last edited by shammat; 03-07-15 at 03:09.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Feb 2010
    Posts
    40

    calculating concurrent calls

    Yes, you are right my mistake. it should include id 2.

    As for the windows, I meant 9:00:00 - 9:00:59. Thanks

    Quote Originally Posted by shammat View Post
    Example 1 should include id=2 as well, shouldn't it?
    Because call 2 was still in progress between 09:00 and 09:01

    And if the interval "09:01:44 - 09:01:55" (id=3) includes the "minute" from 09:00 to 09:01 then shouldn't the interval "09:01:23 09:05:42" (id=1) also include it?

    You should also clarify if by "9:00 - 9:01" you mean "09:00:00 - 09:01:00" or actually ""09:00:00 - 09:01:59"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •