Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Calculating elapsed time between actions within tasks

$
0
0

I have the following data:

TaskID    ActionID    User    ActionDateAndTme

   1              11          1       2008-07-02 08:45:00

   1              12          1       2008-07-02 08:50:00

   1              13          2       2008-08-02 09:45:00

   2              11          1       2008-10-02 08:45:00

   2              12          1       2008-11-02 08:50:00

   2              13          2       2008-14-02 09:45:00

I need the following result:

TaskID    ActionID    User    ActionDateAndTme              ElapsedTime

   1              11          1       2008-07-02 08:45:00              0

   1              12          1       2008-07-02 08:50:00              00:00:05:00 (dd:hh:mm:ss)

   1              13          2       2008-08-02 09:45:00              31:00:55:00

   2              11          1       2008-10-02 08:45:00              0

   2              12          1       2008-11-02 08:45:00              31:00:00:00

   2              13          2       2008-11-02 08:50:00              00:00:05:00


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>