Hi there ... <br>
<br>
I'm trying to build a view using SQL Server, which is based on the following table of information from a web site access log.<br>
<br>
user page access-time<br>
=======================================<br>
tom main.html 12:37:05<br>
tom forum.html 12:40:44<br>
tom careers.html 12:41:50<br>
harry main.html 12:40:48<br>
harry news.html 13:00:00<br>
dick news.html 12:39:03<br>
<br>
From this, I'm trying to derive a view for the length of the session:<br>
<br>
user start time end time<br>
======================================<br>
<br>
tom 12:37:05 12:41:50<br>
dick 12:39:03 12:39:03<br>
harry 12:40:48 13:00:00<br>
<br>
The trick seems to be deriving the end time for a session, which occurs when:<br>
<br>
A new user occurs in the log table (they are all sorted by user name)<br>
<br>
OR<br>
<br>
The user currently being processed has a log entry time that occurs more than 30 minutes after the previous entry (i.e., the user has been inactive for more than 30 minutes)<br>
<br>
Is this slightly beyond SQL (I have a feeling that a view like this would require conditional statements to build it)?<br>
If it is beyong SQL, are there other ways to build views in SQL Server that might solve the problem?<br>
<br>
Thanks in advance .....<br>
<br>
<br>
Raze<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
I'm trying to build a view using SQL Server, which is based on the following table of information from a web site access log.<br>
<br>
user page access-time<br>
=======================================<br>
tom main.html 12:37:05<br>
tom forum.html 12:40:44<br>
tom careers.html 12:41:50<br>
harry main.html 12:40:48<br>
harry news.html 13:00:00<br>
dick news.html 12:39:03<br>
<br>
From this, I'm trying to derive a view for the length of the session:<br>
<br>
user start time end time<br>
======================================<br>
<br>
tom 12:37:05 12:41:50<br>
dick 12:39:03 12:39:03<br>
harry 12:40:48 13:00:00<br>
<br>
The trick seems to be deriving the end time for a session, which occurs when:<br>
<br>
A new user occurs in the log table (they are all sorted by user name)<br>
<br>
OR<br>
<br>
The user currently being processed has a log entry time that occurs more than 30 minutes after the previous entry (i.e., the user has been inactive for more than 30 minutes)<br>
<br>
Is this slightly beyond SQL (I have a feeling that a view like this would require conditional statements to build it)?<br>
If it is beyong SQL, are there other ways to build views in SQL Server that might solve the problem?<br>
<br>
Thanks in advance .....<br>
<br>
<br>
Raze<br>
<br>
<br>
<br>
<br>
<br>
<br>