Hi, I'm terribly new to SQL, and cannot seem to get the desired information out, after trying a few different google searches, and reading through some SQL tutorials.
I think it involves some sort of joins, but cannot get them straight.
Given the following sample tables:
Table 1(Activity This is updated every time a change is made to a task, could be manytimes per day):
ID Who What When
001 John Created 2008-10-01<br>
001 Bill Closed 2008-10-02<br>
001 John Updated 2008-10-03<br>
002 Bill Created 2008-10-04<br>
002 John Updated 2008-10-05<br>
002 Bill Closed 2008-10-06<br>
Table 2(Tasks - This is the main task tracking table):
ID Created Status
001 2008-10-01 Closed
002 2008-10-04 Closed
Table 3(Comments):
ID When Comment<br
001 2008-10-01 "I'm creating a new task"
001 2008-10-02 "I have completed the task"
001 2008-10-03 "Nice job"
002 2008-10-04 "I'm creating a second task"
002 2008-10-05 "This task looks too easy"
002 2008-10-06 "I have completed this easy task"
What SQL (mySQL if it makes any difference) query would I use to find out who had done something on a task that had been closed?
The results would be something like:
Who What ID When Comment
Bill Updated 002 2008-10-03 "Nice job"
Meaning that Bill changed task 002 after it was closed, and added the comment "Nice Job"
Any help would be much appreciated.
Thanks in advance.