Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
swatib
Posting Yak Master
173 Posts |
Posted - 2006-02-04 : 00:47:06
|
I have a table with data like-Agent ID- StartTime - Event1-2006-01-23 11:00:00.000 -Logged In1-2006-01-23 11:15:00.000 -Walkaway1-2006-01-23 11:20:00.000 -RW1-2006-01-23 11:26:00.000 -Logout3-2006-01-23 10:30:00.000 -Logged In3-2006-01-23 10:40:00.000 -Logout6-2006-01-23 14:12:00.000 -Logged In6-2006-01-23 15:00:00.000 -LogoutI want the result as:AgentID::StartTime :: Event :: Login Duration1::2006-01-23 11:00:00.000 ::Logged In :: 00:00:001::2006-01-23 11:15:00.000 ::Walkaway:: 00:00:001::2006-01-23 11:20:00.000 ::RW:: 00:00:001::2006-01-23 11:26:00.000 ::Logout:: 00:26:003::2006-01-23 10:30:00.000 ::Logged In:: 00:00:003::2006-01-23 10:40:00.000 ::Logout:: 00:10:006::2006-01-23 14:00:00.000 ::Logged In:: 00:00:006::2006-01-23 15:00:00.000 ::Logout:: 01:00:00Here Login Duration is in hh:mm:ss format. Don't bother about the same format I just needed the time diff. Also when the event is 'Logout' then the diff between its related 'Logged In' & 'Logout' will be the Login Duration.Please help me 4 this. I did the query for obtaining the diff between its related 'Logged In' & 'Logout' that is 00:26:00, 00:10:00, 01:00:00 etc but I have to show 00:00:00 for rest recordsNjoy Life  |
|
|
swatib
Posting Yak Master
173 Posts |
Posted - 2006-02-04 : 01:47:16
|
Friends I solved the query using Left outer join...........Njoy Life |
 |
|
|
|
|
|