Query help needed (JOIN)
From: Adam Nemitoff <adamn_at_TeamNemitoff.com>
Date: 25 Aug 2004 06:18:57 -0700
Message-ID: <1500ba9f.0408250518.3ab93325_at_posting.google.com>
I have two tables populated during the use of an application to log user events and application states. They are named "EventTable" and "StateTable" and the structures follow:
Date: 25 Aug 2004 06:18:57 -0700
Message-ID: <1500ba9f.0408250518.3ab93325_at_posting.google.com>
I have two tables populated during the use of an application to log user events and application states. They are named "EventTable" and "StateTable" and the structures follow:
EventTable:
ID EventTimeStep EventID
-- ------------- ---------
1 5 E1 2 22 E2 3 56 E3
StateTable
ID StateTimeStep StateID
-- ------------- -------
1 1 S1 2 39 S2
I want to perform a query that reports the StateID of the application at the time that each event was logged to the EventTable. The desired output is:
ID TimeStep EventID StateID
-- -------- ------- -------
1 5 E1 S1 2 22 E2 S1 3 56 E3 S2
3 56 E3 S1
3 56 E3 S2
However, the closest I can get is a query that gives me the wrong state when applying the GROUP BY clause
3 56 E3 S1
Thanks,
Adam Nemitoff Received on Wed Aug 25 2004 - 15:18:57 CEST