0 Replies Latest reply on Jul 26, 2012 5:35 AM by Babar Iftikhar

    Finding time difference for records (same items with different status) in same table

    Babar Iftikhar

      Dear ALL ,


      I have following data (table). Each item i.e. A, B, C have multiple entries at different times with status.


      A8:01:03 AMAvailable
      B8:02:43 AMAvailable
      C8:02:56 AMAvailable
      B8:05:43 AMConsumed
      A8:07:32 AMConsumed
      C8:11:42 AMConsumed
      C8:12:26 AMAvailable
      A8:15:16 AMAvailable
      B8:21:48 AMAvailable
      C8:24:21 AMConsumed
      A8:30:15 AMConsumed
      B8:32:32 AMConsumbed
      For Each Item (A, B, C) - I need to find the time difference (in minutes)  between item's (each) 'Available' Status and 'Consumed' Status.
      For Item 'A':  Time Difference1 = (8:07:32  - 8:01:03) = 6 minutes and 29 secs   [i.e time difference between item A's first consumption and availability)

      For Item 'A':  Time Difference2 = (8:30:15  - 8:15:16) = 14 minutes and 59 secs   [i.e time difference between item A's 2nd consumption and availability)


      The output will be Item A: max (time diff): 14 minutes and 59 secs 

      The output will be Item A: min (time diff): 6 minutes and 29 sec


      Same is applicable for items B and C.


      I need urgent help on this.