mattquantic
Programmer
For the reports I can get things like sessions out by grouping by a var in the cookie.
But some of my clients want different determinations of a session timeout length than others.
What I'm trying to do in a query:
• get the logs for a day (done)
• create a field with an id (sessid) that I set in the query
• establish the time diff in mins in the current row from that of the row above it
• if the time is > 15 min to increment the sessid by 1
• group the results by the sessid
• populate results in a db so the query only needs to run once
I have looked into things a little and am investigating the use of:
select
case when datepart(min, thedatetime) - rowbefore
then [increment+1] as sessit
else [increment] as sessit
end
,col2
,col3
from logtb
where etc etc
The other alternative is to first go though the table and then repopulate another table with the same data, adding a calculated sessid.
Can I borrow your brain?
Matt
But some of my clients want different determinations of a session timeout length than others.
What I'm trying to do in a query:
• get the logs for a day (done)
• create a field with an id (sessid) that I set in the query
• establish the time diff in mins in the current row from that of the row above it
• if the time is > 15 min to increment the sessid by 1
• group the results by the sessid
• populate results in a db so the query only needs to run once
I have looked into things a little and am investigating the use of:
select
case when datepart(min, thedatetime) - rowbefore
then [increment+1] as sessit
else [increment] as sessit
end
,col2
,col3
from logtb
where etc etc
The other alternative is to first go though the table and then repopulate another table with the same data, adding a calculated sessid.
Can I borrow your brain?
Matt