title: How can I get a history like query on MySQL?
body: <p>I'd like a little help here.</p>
  
  <p>I'm building a database in MySQL where I will have a bunch of different activities. Each activity is part of a list.</p>
  
  <p>So, I have the following tables on my database.</p>
  
  <p>List</p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  </ul>
  
  <p>Activity</p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>idList (FK to List)</li>
  </ul>
  
  <p>I also want to know when each activity is finished (you can finish the same activity many times). To accomplish that, I have another table:</p>
  
  <p>History</p>
  
  <ul>
  <li>date</li>
  <li>idActivity (FK to activity)</li>
  </ul>
  
  <p>When the user finishes an activity, I add the id of this activity and the current time the activity was finished, to the History table.</p>
  
  <p>I want to get the entire list with the date it was finished. When an activity has not been finished, I want it to show the date as null.</p>
  
  <p>But, getting the list just once is easy. A simple Left Outer Join will do the trick. My issue here is that I want to get the ENTIRE list everytime a date appears on the history table.</p>
  
  <p>This is what I'm looking for:</p>
  
  <p>List:</p>
  
  <pre><code>id      |       name
  1       |       list1
  </code></pre>
  
  <p>Activity:</p>
  
  <pre><code>id      |       name        |       idList
  1       |     Activity1     |         1
  2       |     Activity2     |         1
  3       |     Activity3     |         1
  4       |     Activity4     |         1
  5       |     Activity5     |         1
  6       |     Activity6     |         1
  </code></pre>
  
  <p>History:</p>
  
  <pre><code>date      |    idActivity       
  17/07/14  |        1
  17/07/14  |        3
  17/07/14  |        4
  17/07/14  |        6
  
  16/07/14  |        2
  16/07/14  |        3
  16/07/14  |        5
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>idActivity     |     idList     |      activityName      |        date           
      1          |        1       |       Activity1        |      17/07/14
      2          |        1       |       Activity2        |        NULL
      3          |        1       |       Activity3        |      17/07/14
      4          |        1       |       Activity4        |      17/07/14
      5          |        1       |       Activity5        |        NULL
      6          |        1       |       Activity6        |      17/07/14
  
      1          |        1       |       Activity1        |        NULL
      2          |        1       |       Activity2        |      16/07/14
      3          |        1       |       Activity3        |      16/07/14
      4          |        1       |       Activity4        |        NULL
      5          |        1       |       Activity5        |      16/07/14
      6          |        1       |       Activity6        |        NULL
  </code></pre>