They are associated by an Account ID
Table 1: Account Table Account ID 1 2
Table 2: Activity Account ID Activity Name Activity Date 1 Test 12.06 1 Example 14.06 2 Test 12.06 3 Example 10.06 Table 3: Event Account ID Event Event Date 1 Event 1 13.05 1 Event 2 13.06 2 Event 1
This is a sample of the 3 tables.
In the above you see Account 1 had two events and both had activities post event so that would both be counted.
Account 2 had one event but no activities for this account happened after this event. So I don't want to count this one.
(The activity table does not necessarily have a direct correlation with an event so there is no activity ID which directly links to an event ID. So that is why I want to use post activity after event)
I want to compare Event Date vs Activity date. It is related via the account but nothing more than that. So I mean you cannot say that this activity was directly related to this event. (More of the analysis issue to solve rather than data issue which I'm trying to solve here)
What I am looking to achieve is find first activity date after an event for every event.