I have two tables that I want to relate.
tbl_1 contains USERID, DATE, TIME, LOGIN_LOGOUT
tbl_2 contains USERID, DATE, TIME, EVENT_DESCRIPTION
For example:
tbl_l
c00014;12/23/2013;12:07:22;login
c00014;12/23/2013;12:12:08;logout
c00014;12/23/2013;12:20:23;login
c00014;12/23/2013;12:25:07;logout
tbl_2
c00014;12/23/2013;11:11:47;Activity Description 7
c00014;12/23/2013;11:11:59;Activity Description 2
c00014;12/23/2013;12:08:46;Activity Description 4
c00014;12/23/2013;12:08:46;Activity Description 7
c00014;12/23/2013;12:09:21;Activity Description 6
c00014;12/23/2013;12:20:20;Activity Description 1
c00014;12/23/2013;12:20:57;Activity Description 1
c00014;12/23/2013;12:20:57;Activity Description 1
c00014;12/23/2013;12:21:05;Activity Description 3
c00014;12/23/2013;12:23:46;Activity Description 4
c00014;12/23/2013;12:27:05;Activity Description 8
c00014;12/23/2013;12:27:19;Activity Description 5
c00014;12/23/2013;12:28:24;Activity Description 8
c00014;12/23/2013;12:28:33;Activity Description 5
What I want to do is to assign a "SessionID" to create sessions in tbl_1 based on the login/logout times (I can do this part) and then query tbl_2 based on time and date in order to determine the "SessionID" during which the activity took place.
The tables have multiple users and multiple days. Any thoughts?
Basically, this is how the sample tables will relate.
tbl_1 contains USERID, DATE, TIME, LOGIN_LOGOUT
tbl_2 contains USERID, DATE, TIME, EVENT_DESCRIPTION
For example:
tbl_l
c00014;12/23/2013;12:07:22;login
c00014;12/23/2013;12:12:08;logout
c00014;12/23/2013;12:20:23;login
c00014;12/23/2013;12:25:07;logout
tbl_2
c00014;12/23/2013;11:11:47;Activity Description 7
c00014;12/23/2013;11:11:59;Activity Description 2
c00014;12/23/2013;12:08:46;Activity Description 4
c00014;12/23/2013;12:08:46;Activity Description 7
c00014;12/23/2013;12:09:21;Activity Description 6
c00014;12/23/2013;12:20:20;Activity Description 1
c00014;12/23/2013;12:20:57;Activity Description 1
c00014;12/23/2013;12:20:57;Activity Description 1
c00014;12/23/2013;12:21:05;Activity Description 3
c00014;12/23/2013;12:23:46;Activity Description 4
c00014;12/23/2013;12:27:05;Activity Description 8
c00014;12/23/2013;12:27:19;Activity Description 5
c00014;12/23/2013;12:28:24;Activity Description 8
c00014;12/23/2013;12:28:33;Activity Description 5
What I want to do is to assign a "SessionID" to create sessions in tbl_1 based on the login/logout times (I can do this part) and then query tbl_2 based on time and date in order to determine the "SessionID" during which the activity took place.
The tables have multiple users and multiple days. Any thoughts?
Basically, this is how the sample tables will relate.