Zeeshan  Azim

Zeeshan Azim

  • 740
  • 1.2k
  • 13.6k

Help me out in this query

Jan 13 2015 12:22 AM
HI,
 
I have a table which contains 4 columns
 
1. ID
2. CreatedOn
3. UserId
4. Status
 
I want calculate total Log in time and total offline time, I will provide Date and User Id to my Stored Procedure. Here is the sample data of the table.
 
Id    CreatedOn                            UserId    Status
70       2014-10-17 17:37:55.493    3          Log In
71       2014-10-17 17:40:27.960    3          Log Out
132     2014-10-20 11:35:18.080    3          Log In
133     2014-10-20 11:35:35.167    3          Log Out
134     2014-10-20 11:35:53.760    3          Log In
137     2014-10-20 11:37:11.397    3          Offline
140     2014-10-20 11:37:56.193    3          Online
141    2014-10-20 11:38:21.810    3          Log Out
473    2014-10-27 17:41:49.443    3          Log In
485    2014-10-27 17:49:51.930    3             Log Out
490    2014-10-28 11:01:23.073    3          Log In
492    2014-10-28 12:18:11.487    3          Log In
496    2014-10-28 13:26:21.097    3          Log In
498    2014-10-28 15:43:37.410    3          Log In
499    2014-10-28 16:04:16.243    3         Log In
502    2014-10-28 17:28:35.557    3             Log In
503    2014-10-28 18:23:22.953    3             Log In
504    2014-10-28 19:24:10.803    3          Log Out
508    2014-10-29 09:26:11.120    3             Log In
509    2015-01-12 19:59:03.537    3             Log In
510   2015-01-12 19:59:03.543    3             Offline
 

Answers (5)