1 Attachment(s)
Calculate time difference between rows
Hi,
I have record stored as shown, (Please find attached file if format not clear)
SHIPMENT_ID MESSAGE_TYPE CREATED_DTTM
9336 5 9/29/2006 9:16:14 AM
9336 10 9/29/2006 10:33:16 AM
9379 5 10/5/2006 11:43:33 AM
9379 10 10/6/2006 7:19:38 AM
10128 5 10/3/2006 8:21:25 AM
10128 10 10/4/2006 10:20:03 AM
and using SQL would need to calculate time difference between message_type 5 and 10 for each Shipment_id.
(9/29/2006 9:16:14 AM) - (9/29/2006 10:33:16 AM)
(10/5/2006 11:43:33 AM) - (10/6/2006 7:19:38 AM)
(10/3/2006 8:21:25 AM) - (10/4/2006 10:20:03 AM)
Expecting results in format after calculating time difference from above for each shipment_id,
SHIPMENT_ID TIME_DIFFERENCE
9336
9379
10128
Thanks,
Siva